I’m working on a project where I need to be able to limit the codec of an outgoing call via the dialplan. Specifically, I need to enable to disable h264 (video) on some calls, while allowing it on others. After doing some research I located Malcolm Davenport’s page on SIP Channel Variables here wiki.asterisk.org/wiki/display/ … +Variables and took a shot and using the SIP_CODEC options referred to. However, this did not appear to have any affect on the call being placed.
The scenario is that asterisk places a call (using a .call file in the /var/spool/asterisk/outgoing directory) and connects it to a music file being played. If the value of the “Video” variable being SET in the .call file is true then the resulting call should be ulaw|h264 if it is false the resulting call should be ulaw only.
The problem that I am having is that if the Video=false (as below) asterisk still sets up ulaw|h264. If I add limit the codec on in the device’s context in sip.conf using disallow=all allow=ulaw, then only ulaw is setup.
Any help that could be provided would be greatly appreciated. I believe that I’ve included all the relevant details, but if I’ve missed something please let me know, I would be more than happy to add additional details.
My config is as follows
Asterisk Version = 11.12.0
The content of the .call file being used
Channel: Local/100105@custom-dtmf-callback
Set: Video=false
Set: Data=003#1001*-1001-02-60
MaxRetries: 0
RetryTime: 10
WaitTime: 45
Context: custom-dtmf-calledwait
Extension: s
Priority: 1
From sip.conf
[general]
disallow=all
allow=ulaw
allow=alaw
allow=gsm
allow=g722
allow=h264
allow=h263
From extensions.confg
[code][custom-dtmf-callback]
exten => _xxxxxx,1,NoOp(Calling the callback process with the DTMF string number)
same => n,Answer()
same => n,NoOp(This callback should be a Video Call: ${Video}
same => n,NoOp(Currently the outgoing codec is ${SIP_CODEC_OUTBOUND} . . . .)
same => n,GotoIf($[${Video} = true]?yesvid:novid)
same => n,Hangup()
same => n(startcallback),NoOp(Starting Callback)
same => n,Wait(${EXTEN:4})
same => n,Set(CDR(userfield)=Callback ${EXTEN:-6:-2} )
same => n,Dial(SIP/${EXTEN:-6:-2})
same => n,Hangup()
same => n(yesvid),Set(SIP_CODEC_OUTBOUND=ulaw&h264)
same => n,Set(SIP_CODEC_INBOUND=ulaw&h264)
same => n,Set(SIP_CODEC=ulaw&h264)
same => n,goto(startcallback)
same => n(novid),Set(SIP_CODEC_OUTBOUND=ulaw)
same => n,Set(SIP_CODEC_INBOUND=ulaw)
same => n,Set(SIP_CODEC=ulaw)
same => n,goto(startcallback)
[custom-dtmf-calledwait]
exten => s,1,NoOp(Called Device Back)
same => n,NoOp(Value of Video: ${Video}
same => n,NoOp(Currently the outgoing codec is ${SIP_CODEC_OUTBOUND} . . . .)
same => n,GotoIf($[${Video} = true]?yesvid:novid)
same => n,Hangup()
same => n(yesvid),Set(SIP_CODEC_OUTBOUND=ulaw&h264)
same => n,Set(SIP_CODEC_INBOUND=ulaw&h264)
same => n,Set(SIP_CODEC=ulaw&h264)
same => n,goto(playback)
same => n(novid),Set(SIP_CODEC_OUTBOUND=ulaw)
same => n,Set(SIP_CODEC_INBOUND=ulaw)
same => n,Set(SIP_CODEC=ulaw)
same => n,goto(playback)
same => n(playback),Background(custom/Ready_to_Go_Up_Higher)
same => n,Hangup()[/code]
Asterisk CLI output is:
-- Attempting call on Local/100105@custom-dtmf-callback for s@custom-dtmf-calledwait:1 (Retry 1)
-- Executing [100105@custom-dtmf-callback:1] NoOp("Local/100105@custom-dtmf-callback-00000030;2", "Calling the callback process with the DTMF string number") in new stack
-- Executing [100105@custom-dtmf-callback:2] Answer("Local/100105@custom-dtmf-callback-00000030;2", "") in new stack
-- Executing [s@custom-dtmf-calledwait:1] NoOp("Local/100105@custom-dtmf-callback-00000030;1", "Called Device Back") in new stack
-- Executing [s@custom-dtmf-calledwait:2] NoOp("Local/100105@custom-dtmf-callback-00000030;1", "Value of Video: false") in new stack
-- Executing [s@custom-dtmf-calledwait:3] NoOp("Local/100105@custom-dtmf-callback-00000030;1", "Currently the outgoing codec is . . . .") in new stack
-- Executing [s@custom-dtmf-calledwait:4] GotoIf("Local/100105@custom-dtmf-callback-00000030;1", "0?yesvid:novid") in new stack
-- Goto (custom-dtmf-calledwait,s,10)
-- Executing [s@custom-dtmf-calledwait:10] Set("Local/100105@custom-dtmf-callback-00000030;1", "SIP_CODEC_OUTBOUND=ulaw") in new stack
-- Executing [s@custom-dtmf-calledwait:11] Set("Local/100105@custom-dtmf-callback-00000030;1", "SIP_CODEC_INBOUND=ulaw") in new stack
-- Executing [s@custom-dtmf-calledwait:12] Set("Local/100105@custom-dtmf-callback-00000030;1", "SIP_CODEC=ulaw") in new stack
-- Executing [s@custom-dtmf-calledwait:13] Goto("Local/100105@custom-dtmf-callback-00000030;1", "playback") in new stack
-- Goto (custom-dtmf-calledwait,s,14)
-- Executing [s@custom-dtmf-calledwait:14] BackGround("Local/100105@custom-dtmf-callback-00000030;1", "custom/Ready_to_Go_Up_Higher") in new stack
-- <Local/100105@custom-dtmf-callback-00000030;1> Playing 'custom/Ready_to_Go_Up_Higher.slin' (language 'en')
-- Executing [100105@custom-dtmf-callback:3] NoOp("Local/100105@custom-dtmf-callback-00000030;2", "This callback should be a Video Call: false") in new stack
-- Executing [100105@custom-dtmf-callback:4] NoOp("Local/100105@custom-dtmf-callback-00000030;2", "Currently the outgoing codec is . . . .") in new stack
-- Executing [100105@custom-dtmf-callback:5] GotoIf("Local/100105@custom-dtmf-callback-00000030;2", "0?yesvid:novid") in new stack
-- Goto (custom-dtmf-callback,100105,16)
-- Executing [100105@custom-dtmf-callback:16] Set("Local/100105@custom-dtmf-callback-00000030;2", "SIP_CODEC_OUTBOUND=ulaw") in new stack
-- Executing [100105@custom-dtmf-callback:17] Set("Local/100105@custom-dtmf-callback-00000030;2", "SIP_CODEC_INBOUND=ulaw") in new stack
-- Executing [100105@custom-dtmf-callback:18] Set("Local/100105@custom-dtmf-callback-00000030;2", "SIP_CODEC=ulaw") in new stack
-- Executing [100105@custom-dtmf-callback:19] Goto("Local/100105@custom-dtmf-callback-00000030;2", "startcallback") in new stack
-- Goto (custom-dtmf-callback,100105,7)
-- Executing [100105@custom-dtmf-callback:7] NoOp("Local/100105@custom-dtmf-callback-00000030;2", "Starting Callback") in new stack
-- Executing [100105@custom-dtmf-callback:8] Wait("Local/100105@custom-dtmf-callback-00000030;2", "05") in new stack
-- Executing [100105@custom-dtmf-callback:9] Set("Local/100105@custom-dtmf-callback-00000030;2", "CDR(userfield)=Callback 1001 ") in new stack
-- Executing [100105@custom-dtmf-callback:10] Dial("Local/100105@custom-dtmf-callback-00000030;2", "SIP/1001") in new stack
== Using SIP VIDEO TOS bits 136
== Using SIP VIDEO CoS mark 6
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
-- Called SIP/1001
-- SIP/1001-00000093 is ringing
-- SIP/1001-00000093 answered Local/100105@custom-dtmf-callback-00000030;2