locked
OCS 2007 R2 + Trixbox 2.8 (help - how to route calls from on OCS client to a SIP extension and vice versa) RRS feed

  • Question

  • I'm trying to set up an integration between OCS 2007 R2 and Trixbox 2.8. My goal is very simple, to allow OCS clients to call SIP extensions (softphones) connected to my Trixbox and vice versa and maybe allow OCS clients to make calls directly to a PSTN line through Trixbox.

    OCS client <-> OCS FE <-> OCS MED <-> Trixbox <-> SIP client or an actual PSTN number

    I have tried implementing the procedures for OCS+trixbox integration found on Mick's Breeze Blog:

    http://blogs.breezetraining.com.au/mickb/2009/07/31/FinallyConnectedOCS2007R2ToTrixboxAsteriskToAPSTNPBX.aspx.

    but somehow I can't seem to make it work. Instead of routing calls from OCS to some SIP provider, I'm trying to find a way for calls to be routed from an OCS client to an extension in my Trixbox. I have already set up a trunk for my OCS but i don't know how to setup a route for calls coming from ocs to connect to sip extensions. Contexts on Asterisk are really confusing. I really need help on this.

    Monday, September 13, 2010 7:29 AM

All replies

  •  

    I can offer advice on config for Asterisk 1.6 - which Trixbox 2.8 is based on.

    You need to work out if your calls are actually reaching Trixbox.

    Do you have normalisation and routing rules set in OCS?

    Do calls reach OCS ok from the Trixbox client?

    Is there an option in Trixbox to view the Asterisk console (sometimes called the Asterisk CLI)?  If so, watch it as you place a call, you should see Asterisk processing the dialplan. That way you can see what it's doing in response to incoming calls.

     

    Contexts are nothing more than a way to divide or control your dialplan.  In the sip.conf file, you define sip objects such as soft clients and the trunk to OCS.  As part of the definition of each object, you can define a context for that SIP object.

    Incomings calls from those SIP objects goto the section in the dialplan (the extensions.conf) that matches the context you set.

    For example - if you set a context of 'OCS-Incoming' for your OCS trunk, when you get calls from OCS, it will look for the context in the dialplan that matches that name (OCS-incoming).

     

    For Asterisk guides - I recommend http://www.voip-info.org/wiki/view/Asterisk

    You probably already know this, but the forum at Trixbox is a good resource http://fonality.com/trixbox/forum

    Regards

    Paul Adams

     

    Monday, September 13, 2010 2:32 PM
  • Hi Paul,

    Thanks, your questions put me in the right direction. Here's my set up:

    i have the following virtual machines:

    1 - OCS Front End Server

    1 - OCS Mediation Server

    1 - Windows 2003 Server AD

    1 - Trixbox 2.8

    i have 2 OCS client users:

    User01 - tel:+5001

    User02 - tel:+5002

    I configured the next hop connections of my OCS MED server pointing them to my Trixbox server.

    And for the normalisation rules are as follows:

    Phone Pattern Regular Expression: ^(5\d{2}\d+)$

    Translation Pattern regular expression: +$1

    On the trixbox server, I created a trunk for OCS

    Trunk Name : OCS

    PEER Details :
    host=192.168.100.4
    type=peer
    qualify=yes
    transport=tcp
    insecure=very
    port=5060
    canreinvite=yes
    fromdomain=litwareinc.com
    context=from-OCS
     
    Incoming Settings :
    User context : OCSUser
    host=192.168.100.4
    transport=tcp
    port=5060
    insecure=very
    type=peer
    context=from-OCS

    and 2 extensions 5003 and 5004

    I also configured 2 outbound routes to my OCS MED Server

    [outrt-001-9_outside]
    include => outrt-001-9_outside-custom
    exten => _9.,1,Macro(user-callerid,SKIPTTL,)
    exten => _9.,n,Set(_NODEST=)
    exten => _9.,n,Macro(record-enable,${AMPUSER},OUT,)
    exten => _9.,n,Macro(dialout-trunk,3,${EXTEN:1},,)
    exten => _9.,n,Macro(outisbusy,)

    ; end of [outrt-001-9_outside]

    [outrt-002-ToOCS]
    include => outrt-002-ToOCS-custom
    exten => _5XXX,1,Macro(user-callerid,SKIPTTL,)
    exten => _5XXX,n,Set(_NODEST=)
    exten => _5XXX,n,Macro(record-enable,${AMPUSER},OUT,)
    exten => _5XXX,n,Macro(dialout-trunk,3,${EXTEN},,)
    exten => _5XXX,n,Macro(outisbusy,)

    ; end of [outrt-002-ToOCS]

    I was studying the following lines from mick breeze's blog but they didn't seem fit for my setup

    ---------------------------------------------------------------------------

    [from-ocs]
    exten => _X.,1,Answer
    exten => _X.,2,Dial(SIP/${EXTEN}@siptrunk,,tr)
    #include extensions-away-status.conf

    [from-siptrunk]
    exten => _X.,1,Set(numDialled=+${EXTEN:Number_of_X_to_ignore})
    exten => _X.,2,Set(__FROM_DID=${EXTEN})
    exten => _X.,3,Answer
    exten => _X.,4,Dial(SIP/${numDialled}@ocs,,tr)
    exten => _X.,4,Dial(SIP/${numDialled}@ocs)

    ---------------------------------------------------------------------------


    So I tried using another one which is from an integration of Asterisk(not trixbox) and OCS2007. Though trixbox is asterisk based, it's config file structure differ a little with Asterisk. I got a little confused when i tried following the instructions from:<http://blogs.technet.com/b/gclark/archive/2008/10/09/asterisk-1-6-with-office-communications-server-2007.aspx

    i placed the following codes on extensions_custom.conf instead of extensions.conf:

    (i did some modification to accommodate my two extensions)

    [from-OCS]

    exten => _+XXXX,1,Answer()
    exten => _+XXXX,n,Set(CALLERID(name)="OCS call")
    exten => _+XXXX,n,Set(CALLERID(num)=${CALLERID(num):1})
    exten => _+XXXX,n,Goto(${EXTEN:1},1)

    exten => 5003,1,Answer()
    exten => 5003,n,Dial(SIP/5003,20,tr)
    exten => 5003,n,Hangup

    exten => 5004,1,Answer()
    exten => 5004,n,Dial(SIP/5004,20,tr)
    exten => 5004,n,Hangup

    include => outbound
    [outbound]
    exten => _5XXX,1,Set(EXT=+${EXTEN})
    exten => _5XXX,n,Dial(SIP/SIP_TRUNK/${EXT})
    exten => _5XXX,n,Busy

    #include extensions-away-status.conf
     

    I used putty to monitor the activity of asterisk then tried to make calls from my OCS clients to my extensions and vice versa. So far both outbound routes with different dial patterns connects calls from my sip extensions to my OCS clients. I'm trying to experiment a little more. I have an existing trixbox server on production and i'll see if i could route calls from OCS to this server thru my virtual Trixbox Server. I have initially tried connecting two trixbox servers using IAX trunks.

     

     

     

    Thursday, September 16, 2010 10:08 AM
  • I'm glad it's working out.

    Just in case no-one said anything - virtualisation and real time voice don't play well with each other in production.  That might change in the future, but for now, I'd avoid virtualisation for real time communications.  Perfectly fine in a test lab.

    It seems to me your OCS setup is OK and your Trixbox setup is 'kind of' OK.  You might be better off posting specific Trixbox issues to the Trixbox forum.  I have seen some funky stuff on thier forum - they do have some good tech people over there.

    Regards

    Paul Adams

    Thursday, September 16, 2010 3:41 PM
  • hi Paul,

    Do you have any idea how i could forward calls from OCS to another trunk line, possibly a PSTN line depending on the number pattern? 

    OCS call ----------> Trixbox ----------> PSTN Trunk

    I'd like trixbox to recieve a call from OCS and depending on the number pattern, Trixbox will decide whether to connect it to a local extension or forward it to another outbound trunk. How do you implement this on Asterisk?

    Thanks,

    Ron

    Tuesday, September 21, 2010 7:17 AM
  • In your own posts above - you have dialplan instructions for calls from OCS - like this

    exten => 5003,1,Answer()
    exten => 5003,n,Dial(SIP/5003,20,tr)
    exten => 5003,n,Hangup

     

    Within the same "from-OCS" content - add more instructions to route other numbers - for example

    exten => +1XXX.,1,Answer()
    exten => +1XXX.,n,Dial([whatever_your_PSTN_trunk is]/$EXTEN)
    exten => +1XXX.,n,Hangup

    This will route all number starting with +1 and then at least 4 more numbers.  The period symbol "." is liek a wildcard - match any single or multiple digits.

    I'm not sure the exact syntax of how Trixbox does it - ansd I believe Trixbox has a menu driven interface to make things easier.

    If it helps - Asterisk dialplan help is here - http://www.voip-info.org/tiki-index.php?page=Asterisk%20config%20extensions.conf

    regards

    Paul Adams
    pauladamsit.com

    Tuesday, September 21, 2010 3:30 PM
  • Hi,

    Glad you found my blog article useful. In that article I'm actually routing through Asterisk to another party.

    You're wanting the call to be routed to an asterisk extension.

    I like your lines

    exten => 5003,1,Answer()
    exten => 5003,n,Dial(SIP/5003,20,tr)
    exten => 5003,n,Hangup

    Where basically you're 'hardwiring' if a number dialled is '5003' then run the above lines.
    You need to sit down with a connection to Asterisk and look at the SIP debug information (how-to is in my blog post).

    The thing I find, is that even though you dial '5003' from the OCS client, OCS may translate that number to for e.g. +61 5003.
    Which means - your pattern match on your lines won't match.

    If you can get away from Asterisk 'answering' & 'hanging' up then that would be ideal - leave that up to the client. You don't want your local exchange answering the call, then routing to your house only for the caller to get all the feedback that you've answered the phones.

    So one of the things I do is to add a 'sound' to your call. Play a sound over the line to confirm your lines are being run.
    Below I've used 'beep', but there's some classics that come with Asterisk - such as:
    are-you-still-there2
    marryme
    step-in-stream

    I've since modifed my lines (for our local implementation) to:
    exten => _X.,1,Background(beep)
    exten => _X.,2,Dial(SIP/${EXTEN}@MyNetFone,,tf)

    Let me know how you get on and send through a SIP debug session if you like.

    Cheers,

    Mick.

     

     


    Mick Badran - http://blogs.breezetraining.com.au/mickb
    Tuesday, January 18, 2011 12:48 AM