Codec selection for inbound route

Discussion in 'General' started by jandir, Sep 16, 2008.

  1. jandir

    Joined:
    Aug 24, 2008
    Messages:
    65
    Likes Received:
    0
    How can I restrict/select the codec(s) used on an inbound route.

    I have an inbound route setup from IPKall to my elastix box (Note that there is no Trunk configured for this IPKall route since this line is inbound only). I can successfully receive calls from IPKall to my Elastix box but I want to force the codec to g729. From the SIP traces (see below) I see that IPKall offers ulaw, alaw, gsm, g729, etc. but the SIP traces show that Elastix only supports ulaw and alaw for this SIP INVITE.

    How do I enable/force g729 codec for the inbound route? I don't see any allow/disallow options in the webgui for the inbound routes.

    I have installed g729 coded as per "Elastix without Tears" and can see g729 being used for outgoing calls to Gizmo5 trunk (sip show channels at the Asterisk CLI shows g729 being used).

    Thanks.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From SIP Trace dump ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Capabilities: us - 0xc (ulaw|alaw), peer - audio=0x50e (gsm|ulaw|alaw|g729|ilbc)/video=0x0 (nothing), combined - 0xc (ulaw|alaw)
    Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
  2. mihpel

    Joined:
    May 8, 2007
    Messages:
    87
    Likes Received:
    0
    edit sip_custom.conf and add

    Note that the order in which you set the allow=codec will be the preferred order in which peers will negotiate the finally used codec.

    For example if under disallow=all you have allow=g729 asterisk will initially negotiate using that codec with each peer.
    If a peer does not support g729 then asterisk will ask using the next available under allow=g729 and so on.
     
  3. mihpel

    Joined:
    May 8, 2007
    Messages:
    87
    Likes Received:
    0
    Come to thinking of it .... :) (assuming you use freepbx)

    a better solution would be adding

    under PEER details and USER details in the IPKall trunk configuration
     
  4. jandir

    Joined:
    Aug 24, 2008
    Messages:
    65
    Likes Received:
    0
    I don't have a trunk setup for this inbound route (it work fine without the trunk). Should I/ Do I need to setup a trunk for this? The IPKall line only supports incoming calls. I already have the g729 specified for the trunk I use for outgoing calls and it seems to works fine.

    For the first solution where you suggest I should add the codecs to the sip_custom.conf file, will it apply to all inbound routes? trunks? Where is this file located?
     
  5. mihpel

    Joined:
    May 8, 2007
    Messages:
    87
    Likes Received:
    0
    How does IPKall knows where to forward your traffic if you haven't setup an appropriate trunk containing username-password-IPKall's domain (ex. voip.ipkall.net) , etc?

    sip_custom.conf can be found under /etc/asterisk/ but you can access-edit it through elastix web gui.
    changes made at sip_custom.conf apply globally.
     
  6. jandir

    Joined:
    Aug 24, 2008
    Messages:
    65
    Likes Received:
    0
    IPKall (ipkall.com) does not need a SIP register. IPKall gives a free DID and I just configure my Elastix box public IP (dynamic DNS) and the extension that I want the invite to come to. All of this is configured on the ipcall.com website under my account. Whenever someone calls the ipkall number it will send my elastix box a SIP INVITE to the configured extension (in my case a group extension). I have configured Elastix to accept anonymous SIP calls.

    IPKall's configuration does not let me select the Codecs to be used. They make the SDP offer with all the codecs they support as you can see above.
     
  7. mihpel

    Joined:
    May 8, 2007
    Messages:
    87
    Likes Received:
    0
    While trying to figure out what IPKall is :) i found out that in order to force a codec on it you have to setup a trunk.

    do it like following:

    1. click add sip trunk
    2. leave everything blank except the following items

    Outgoing Settings

    Trunk Name: ipkall
    Peer Details

    context=from-pstn
    host=voiper.ipkall.com
    type=peer

    Incoming Settings

    USER Context from-trunk
    USER Details:

    allow=g729
    context=from-trunk
    disallow=all
    dtmfmode=rfc2833
    host=voiper.ipkall.com
    insecure=very
    type=peer


    hope it helps!
     
  8. jandir

    Joined:
    Aug 24, 2008
    Messages:
    65
    Likes Received:
    0
    Did not work. Same behavior as earlier.
     
  9. mihpel

    Joined:
    May 8, 2007
    Messages:
    87
    Likes Received:
    0
    Are you sure you have g729 working on your system?

    If yes try setting sip_custom.conf as described in earlier post and check what happens.
     
  10. jandir

    Joined:
    Aug 24, 2008
    Messages:
    65
    Likes Received:
    0
    Yes, changing sip_custon.conf works. Traces below. And channel list showed that g729 was being used towards ipkall.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Capabilities: us - 0x106 (gsm|ulaw|g729), peer - audio=0x50e (gsm|ulaw|alaw|g729|ilbc)/video=0x0 (nothing), combined - 0x106 (gsm|ulaw|g729)
    Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
  11. mihpel

    Joined:
    May 8, 2007
    Messages:
    87
    Likes Received:
    0
    Thats nice to hear.

    If you have no problem leaving sip_custom.conf as it is then everything is fine.

    Anyway i would suggest that you try and force the codec through a trunk for better control of your system.

    Regards
     

Share This Page