Set Call Codec in extension.conf

Home » Asterisk Users » Set Call Codec in extension.conf
Asterisk Users 19 Comments

Hi All,
I am trying to set call codec at extension.conf but it doesnt work … its like my command doesnt change anything

exten=6500,1,Answer
exten=6500,2,Playback(welcome)
exten=6500,3,SIPAddHeader(email:${SIP_HEADER(email)})
exten=6500,4,MixMonitor(${STRFTIME(${EPOCH},GMT-6,%C%y-%m-%d//%C%y-%m-%d_%H:%M:%S_%A)}_${SIP_HEADER(email)}.wav,b)
exten=6500,5,set(SIP_CODEC=gsm) — this is not changed ….
exten=6500,6,Queue(${EXTEN})

can any body help me with that?

19 thoughts on - Set Call Codec in extension.conf

  • anyhelp guys?
    I tried a lot of stuff but it doesnt work …. the Codec for audio call only cannt be set…how I can set the call type video/audio at dail plan?
    ________________________________________
    Sent: Wednesday, January 04, 2012 5:53 AM

    Hi All,
    I am trying to set call codec at extension.conf but it doesnt work … its like my command doesnt change anything

    exten=6500,1,Answer
    exten=6500,2,Playback(welcome)
    exten=6500,3,SIPAddHeader(email:${SIP_HEADER(email)})
    exten=6500,4,MixMonitor(${STRFTIME(${EPOCH},GMT-6,%C%y-%m-%d//%C%y-%m-%d_%H:%M:%S_%A)}_${SIP_HEADER(email)}.wav,b)
    exten=6500,5,set(SIP_CODEC=gsm) — this is not changed ….
    exten=6500,6,Queue(${EXTEN})

    can any body help me with that?

  • 1.6 and 1.8 … I tried changing stuff on both ….
    when I make audio call from my client which supports both audio and video its sent to the other client as video call …..I tried settings the SIP_CODED_INBOUND and outbound also … but no luck
    ________________________________________
    Sent: Wednesday, January 04, 2012 11:11 AM

    Providing which version of Asterisk you are using might be helpful.

  • 1.6 does not support setting the outbound codec. 1.8 uses different variables to set the outbound codec. See UGRADE.txt in the Asterisk source for the 1.8 information,.

  • I tried also in asterisk 1.8 setting outbound variable …. but didnt work also ….
    https://wiki.asterisk.org/wiki/display/AST/chan_sip+Channel+Variables
    check the above … I changed it and tried …. but still I get a video call
    ________________________________________
    Sent: Wednesday, January 04, 2012 11:19 AM

    1.6 does not support setting the outbound codec. 1.8 uses different variables to set the outbound codec. See UGRADE.txt in the Asterisk source for the 1.8 information,.

  • how …. can u give me a command?!..
    ________________________________________
    Sent: Wednesday, January 04, 2012 11:29 AM

    My guess is that you should set the codec either before SIPADDHEADER or
    before ANSWER.

  • Move line 5 up to line 3 or line 1 (P.S. – the 1-6 numbering scheme is
    cumbersome; 1-n-n-n-n-n is more practical).
    Like this
    exten=6500,1,Answer
    exten=6500,n,Playback(welcome)
    exten=6500,n,set(SIP_CODEC=gsm) — this is not changed ….
    exten=6500,n,SIPAddHeader(email:${SIP_HEADER(email)})
    exten=6500,n,MixMonitor(${STRFTIME(${EPOCH},GMT-6,%C%y-%m-%d//%C%y-%m-%d_%H:
    %M:%S_%A)}_${SIP_HEADER(email)}.wav,b)
    exten=6500,n,Queue(${EXTEN})

    or
    exten=6500,1,set(SIP_CODEC=gsm) — this is not changed ….
    exten=6500,n,Answer
    exten=6500,n,Playback(welcome)
    exten=6500,n,SIPAddHeader(email:${SIP_HEADER(email)})
    exten=6500,n,MixMonitor(${STRFTIME(${EPOCH},GMT-6,%C%y-%m-%d//%C%y-%m-%d_%H:
    %M:%S_%A)}_${SIP_HEADER(email)}.wav,b)
    exten=6500,n,Queue(${EXTEN})

  • didnt work also ….:(
    ________________________________________
    Sent: Wednesday, January 04, 2012 11:39 AM

    Move line 5 up to line 3 or line 1 (P.S. – the 1-6 numbering scheme is
    cumbersome; 1-n-n-n-n-n is more practical).
    Like this
    exten=6500,1,Answer
    exten=6500,n,Playback(welcome)
    exten=6500,n,set(SIP_CODEC=gsm) — this is not changed ….
    exten=6500,n,SIPAddHeader(email:${SIP_HEADER(email)})
    exten=6500,n,MixMonitor(${STRFTIME(${EPOCH},GMT-6,%C%y-%m-%d//%C%y-%m-%d_%H:
    %M:%S_%A)}_${SIP_HEADER(email)}.wav,b)
    exten=6500,n,Queue(${EXTEN})

    or
    exten=6500,1,set(SIP_CODEC=gsm) — this is not changed ….
    exten=6500,n,Answer
    exten=6500,n,Playback(welcome)
    exten=6500,n,SIPAddHeader(email:${SIP_HEADER(email)})
    exten=6500,n,MixMonitor(${STRFTIME(${EPOCH},GMT-6,%C%y-%m-%d//%C%y-%m-%d_%H:
    %M:%S_%A)}_${SIP_HEADER(email)}.wav,b)
    exten=6500,n,Queue(${EXTEN})

  • You are fighting a losing battle – you can’t control the other end
    Ignoring ${SIP_CODEC} variable because it is not shared by both ends.

    You can probably do a SIP SET DEBUG ON and see what codecs are available on
    the other end.

  • I am the other end …. most codecs are available ….
    now my problem is when I make audio call using one side its converted to video call request (since my other end has also all codecs)
    my app clients can do Audio and Video call,
    now the Video call is ok
    but the Audio part get converted to video request …so I am trying to limit the codec to only audio codec…
    ________________________________________
    Sent: Wednesday, January 04, 2012 11:54 AM

    You are fighting a losing battle – you can’t control the other end
    Ignoring ${SIP_CODEC} variable because it is not shared by both ends.

    You can probably do a SIP SET DEBUG ON and see what codecs are available on
    the other end.

  • Any suggestion will be great ….
    ________________________________________
    Sent: Wednesday, January 04, 2012 11:55 AM

    I am the other end …. most codecs are available ….
    now my problem is when I make audio call using one side its converted to video call request (since my other end has also all codecs)
    my app clients can do Audio and Video call,
    now the Video call is ok
    but the Audio part get converted to video request …so I am trying to limit the codec to only audio codec…
    ________________________________________

  • there is nothing in sip.conf about what u asked
    but 6500 is a queue with following info
    [6500]
    fullname = testing
    strategy = rrmemory
    timeout = 15
    wrapuptime = 15
    autofill = no
    autopause = no
    joinempty = yes
    leavewhenempty = no
    reportholdtime = no
    maxlen = 0
    musicclass = test
    member = SIP/6251
    member = SIP/6252
    member = SIP/6253
    member = SIP/6254

    now the user 6251 is a user with following info and caller 6000

    [6000]
    username = 6000
    transfer = yes
    mailbox = 6000
    call-limit = 100
    type = peer
    fullname = 6000
    registersip = no
    host = dynamic
    callgroup = 1
    type = peer
    context = DLPN_DialPlan1
    cid_number = 6000
    hasvoicemail = no
    vmsecret =
    email =
    threewaycalling = no
    hasdirectory = no
    callwaiting = no
    hasmanager = no
    hasagent = no
    hassip = yes
    hasiax = yes
    nat = yes
    canreinvite = no
    dtmfmode = rfc2833
    insecure = no
    pickupgroup = 1
    disallow = all
    allow = ulaw,gsm,h263,h263p,h264
    autoprov = no
    label =
    macaddress =
    linenumber = 1
    LINEKEYS = 1
    callcounter = yes

    [6251]
    username = 6251
    transfer = yes
    mailbox = 6251
    call-limit = 100
    type = peer
    fullname = 6251
    registersip = no
    host = dynamic
    callgroup = 1
    type = peer
    context = DLPN_DialPlan1
    cid_number = 6251
    hasvoicemail = no
    vmsecret =
    email =
    threewaycalling = no
    hasdirectory = no
    callwaiting = no
    hasmanager = no
    hasagent = yes
    hassip = yes
    hasiax = yes
    nat = yes
    canreinvite = no
    dtmfmode = rfc2833
    insecure = no
    pickupgroup = 1
    disallow = all
    allow = ulaw,gsm,h263,h263p,h264
    autoprov = no
    label =
    macaddress =
    linenumber = 1
    LINEKEYS = 1

    ________________________________________
    Sent: Wednesday, January 04, 2012 12:00 PM

    Please post the sip.conf entries for 6000 and 6500.

  • allow=all
    ________________________________________
    Sent: Wednesday, January 04, 2012 12:09 PM

    What about the allow/disallow lines in sip.conf?

  • yup …. and video support is yes
    ________________________________________
    Sent: Wednesday, January 04, 2012 12:15 PM

    Both sides?