OCS2k7, OpenSer, and Asterisk RRS feed

  • Question


    Does anyone have a working openser.cfg they could share which acts like a gateway between asterisk and OCS?


    I've searched all over the net and all the solutions listed always have something missing. I need to get OCS to make outbound calls through the SIP trunks on the Asterisk box and I need inbound calls to be routed to the OCS server.


    Here is my setup:


    PSTN -> Asterisk <----> OpenSER <----> Mediation server <-----> OCS


    Any help would be greatly appreciated.


    Thank you,



    Thursday, February 14, 2008 5:58 AM

All replies


    Thanks for the link, however I've already been there and tried their guide to no avail. None of the documents I've seen out there actually work and I've followed them step by step. I'm open to using OpenSER, Sipx, or any other open source solution to the MS issue. Thanks.



    Tuesday, February 19, 2008 6:08 PM
  • Hello Eric - I'm setting up this environment right at this second.


    I'm using the notes from here:




    I've got Asterisk & OpenSER on the same box - I simply set OpenSER to a different port then 5060 so Asterisk could run as normal on the box (in case I plan to use Asterisk to support normal SIP phone).


    I'd like keep in touch to swap notes on all of this...


    padams at freightliner dot bc dot ca








    Tuesday, February 19, 2008 6:44 PM
  • Paul,


    We tried to follow that article as well, but there is very little detail in the Asterisk configuration section. We also had issues with the openSER routing section. The provided cfg file didn't route traffic as expected. We monitored all servers with network sniffers to watch the SIP handshakes.


    Feel free to contact me:


    ewestrom at hotmail dot com


    Wednesday, February 20, 2008 3:05 AM

    Follow up for those who are interested...


    I setup a test environment as per the article


    and it does work - but as Eric pointed out - it does leave out a large section of Asterisk config.


    Asterisk config is a huge subject and there are many good books & websites about it.  Maybe this is why they left it out - but it does make it difficult if you don't know where to start.


    Please find below some tips to 'fill the gaps'.  I've been keeping easy, step by step notes.  If people are interested - I could type them up and make them available.







    padams at freightliner dot bc dot ca




    I have OpenSER & Asterisk on the same machine.  I tried to get it to redirect to a different port - but no success.

    I read that OpenSER must have different IP addresses to route to - so I installed a second network card & assigned a second IP address.


    We shall call the first IP address the openser address & the second IP address the Asterisk address


    In the openser.cfg - set the listen IP address of the first network card - like the 2 lines below:



    Note that at the bottom of the openser.cfg file, the last IP address that says it's for the Asterisk server is wrong - it should be your Mediation server.






    In the top of the sip.conf file is a section called [general].  Inside here will be a line saying



    Make a note of what this context is set to - this is your default context.



    Set the bindaddr line to the  IP address of the second network card - like this:




    Further down in the sip.conf file - we shall let Asterisk know about OpenSER.  .  The name inside the square brackets assigns this name to this 'peer'.  The context name assigned here defines how it will flow in the Asterisk dailplan.


    Enter the following:












    Inside here is the dialplan for Asterisk - it tells it how to deal with calls.  Apart from the first two sections, (called [general] & [globals]), the rest are customisable & can be anything you want.


    In here will be (should be) a context starting with the line



    In this section, I've added an extension line to dial OCS using a test number.  My test number was 5849.  This is the line:

    exten => 5849,1,Dial(SIP/+12345675849@openser)


    This tells Asterisk to dial using SIP, the number +12345675849 using the 'peer' we difined in sip.conf called openser.



    At the bottom of this file, we shall re-use the context we used in the sip.conf & what to do with it.



    after this heading comes dialplan commands to deal with incoming calls from openser



    Checking it's working...

    From a normal Linux command prompt on the Asterisk server - type:

    asterisk -r


    This will show you the command prompt of the Asterisk server - but more helpful - it will display what's happening, for example - when soft phone clients connect or when calls come in from the ocs box.


    Using this - I was able to tell that calls to Asterisk from OCS was working fine - but Asterisk was not processing the calls correctly in the dialplan.


    From the Asterisk command prompt - use the command reload to reload changes you are making to the config files without restarting the entire server.



    Configuring the Asterisk dialplan can be daulting - but hopefully - this should get you to a point where you can prove OCS is communicating to Asterisk (& visa versa).  The rest is experimenting & reading up on Asterisk config.

    Tuesday, February 26, 2008 7:15 PM
  • Paul,


    Thank you for the excellent notes. I've been able to see the traffic flowing as it should between Asterisk and OCS, however, I am unable to actually connect to an extension in asterisk or route out to the PSTN through asterisk. Any thoughts?



    Friday, February 29, 2008 6:07 PM

    Thoughts? Yes - your learning curve of Asterisk config begins... 


    This is an OCS forum - and there are many excellent Asterisk forums (I recommend http://www.voip-info.org/wiki-Asterisk) - so let's not go on too much about Asterisk configs here - but I use the stuff below to help me...


    Put this macro in your extensions.conf file



    exten => s,1,Answer

    exten => s,n,Wait(1)

    exten => s,n,Playback(ss-noservice)

    exten => s,n,Wait(1)

    exten => s,n,SayDigits(${ARG1})

    exten => s,n,Hangup


    This macro (when triggered) answers the call, waits 1 second, plays back to you that the number is not in service, then reads back to you the numbers you dialed, then hangs up.



    Then - also inside your extensions.conf file - place the following line inside ANY context you are trying to debug.  To start with I suggest you put it in all contexts - then experiment by removing it to test what contexts are doing or not doing.


    exten => _xx.,1,Macro(notinservice,${EXTEN})


    The _xx. catches any number in the context & routes it to the macro.



    Using this - I can call any non-OCS-based number from my OC client & get a response.  That way - you can hear the playback & prove that it's all flowing as it should - and nothing beats the call being answered and hearing a voice back!



    From this point forward - it's experimentation & learning with Asterisk...


    And good luck!



    Friday, February 29, 2008 7:19 PM
  • Hi guy,
    I have integrated Asterisk with OCS through OpenSer. The problem is when I call Communicator to my soft/hard sip-phone. The error of the Communicator is ID 28, a error unknown for me.
    The calling from Communicator to sip-phone works fine.
    Why? Any Idea?

    Tuesday, July 15, 2008 8:11 AM

    Sorry - I do not know what error ID 28 is.



    The following helped me sort out a few minor voice issues in my setup - maybe they can help you...


    - I put Asterisk, OpenSER & the 'gateway NIC' of the OCS Mediation server in a different IP addressing scheme

    - OCS uses ULaw. When installing Asterisk - I choose to every option I could using ULaw & removed as much other stuff as possiple.

    - In the Asterisk sip.conf file - under the definition sections for every device or gateway, I set disallow=all then allowed ulaw.  I also set everything to nat=yes & reinvite=no



    Using this setup - everything worked fine - including placing calls on hold in OC.



    Also - if you are using the X-Lite / EyeBeam client & your calls to OCS go to voicemail but ALWAYS times out & drops the call after 30 seconds - it's a common issue with that client but easily fixed with some option changes.  It's easy to find - just Google for the solution.






    Tuesday, July 15, 2008 3:02 PM
  • Paul, thanks.
    I set
    disallow=all then allowed ulaw and all works fine

    Wednesday, July 16, 2008 9:53 AM

  • hi
    can you please tell me if you achieved integration between asterisk and OCS2007?

    I am highly interested

    Please reply to: ahammoud at g m a i l . c o m
    Friday, July 25, 2008 12:31 AM

    Hi Ahmad - we've spoken via e-mail - but to expand a few points & for others...



    'Intergration' needs further definition.


    True, seamless, full CSTA control intergration (as I believe Cisco & Nortel CS1000 has) does NOT work today (as far as I am aware).  I understand people are working on it.


    'Just voice' (sip) intergration - including calls on hold working correctly in OCS, transfer working correctly in OCS, music on hold from Asterisk workng correctly - then yes.



    I have 'just voice' intergration in-place & working right now - has been for a couple of months.  I only have 3 users on it for testing - using Polycom CX200 phones / webcams / OC on thier desks.  We think it's wonderful...


    I am in the process of linking the Asterisk box to the 'outside world' with a red-fone T1 PRI device.  I shall then start moving more users to this.



    There is more then one way to 'link' the systems - but I've had success using the following...


    Asterisk > OpenSER > OCS Mediation > OCS


    I put Asterisk & OpenSER on the same machine with 2 network cards.


    Was this a '10 minute' job? - no, it was steep learning curve, but we (I) feel it's worth it so we can customise the phone system to do whatever we like in the future.


    Is there a 'step-by-step' guide? - no, it requires learning a few different things - 








    This is a very useful website for this.











    Paul Adams

    Friday, July 25, 2008 3:23 PM
  • Hi Paul,

    Please i need help Urgently, i followed your steps and applied what are in the links you have published one by one , and at final i could only call from OCS to Asterisk but the revers process is not successfully done .. I made the same configuration of OCS and Mediation , what should be done to fix this issue ??

    Please reply mea as quick as possible

    Thanks in advance ,
    Tuesday, September 15, 2009 10:51 AM

  • Hello Sherif,

    Things have moved on since these posts - so unless you HAVE to use Asterisk 1.4 & OCS Version 1 - I fully recommend you use Asterisk 1.6 & OCS R2.

    Asterisk 1.6 can use SIP over TCP/IP - which means you do not need OpenSER in-between - AND - being placed on-hold works fine.  It is far easier to setup & reduces the stress...

    I can recommend Geoff's website...

    I am running this configuration in a live enviroment & it's proved to be extremly stable & reliable.

    I would advise switching on QoS (DiffServ) for OCS & OCS Mediation server - it's NOT on by default.  Depending on which version of Linux you use, Linux / Asterisk will automatically use QoS if it is present (I've got CentOS 5.2, Asterisk

    I use NetGear GS748TS switches - 48 ports, 1GB per port, 20GB links between each switch (they are stackable), and they offer DiffServ - and they were 1/3rd the price of HP switches.  I took a risk, saved some cash & tried them - and they've been working great (if you restart them once a month - and you can do that remotely via the web interface).  We are now moving to these switches at our 3 other locations... 

    I hope this rambliing helps...  :-)


    Paul Adams

    Tuesday, September 15, 2009 10:32 PM
  • Dear Paul,

    Last Question , I have successfully done the Task , and now they are working well , from OCS to Asterisk and vice Versa,
    The question is : did you use TLS or MTLS in OCS ??

    Thanks in Advance ,
    Thursday, September 17, 2009 11:24 AM

  • MTLS - and for this reason...


    I got issues when I tried using TLS


    Paul Adams
    Thursday, September 17, 2009 6:22 PM