Asterisk run commands on Bridged Channel


I’m trying to get live codec re-negotiation during the call using PJSIP on both Caller and Callee channel.
I’ve found, that running command PJSIP_SEND_SESSION_REFRESH() on Callee channel that is already bridged is possible with Dial command with U option.
But how to invoke same command for Caller channel when it’s got bridged?
Thing I tried it’s Dial with G option, but I failed to bridge channels after, as after transferring em to some location I’m not able to correlate ChannelID’s, means cannot find from Caller channel info Callee channel.

Can you please advice what could be done in this case?
Thanks in advance!

Use the _ mechanism to set a variable to the caller’s channel name, so that it is inherited to the callee.

Please note that there is no bridge when the U subroutine is run.


Thanks, I’ve managed to run commands separately on both legs, but unfortunately cannot set codec list to renegotiate on established channel.
Seems, if I invoke this commands on caller channel


actual update is not sent, on a callee channel it’s working though.
More or less code looks like

exten => _X.,1,Set(_CALLER_CHAN_ID=${CHANNEL})
exten = > _X.,n,Dial(PJSIP/${EXTEN}@${TRUNK},,G(codec_adjust_handler^s^1))
exten => s,1,Goto(caller_chan,s,1)
exten => s,2,Goto(callee_chan,s,1)

exten => s,1,Set(PJSIP_MEDIA_OFFER(audio)=!all,alaw))
 same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
 same => n,Wait(1)

exten => s,1,Set(PJSIP_MEDIA_OFFER(audio)=!all,alaw))
 same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
 same => n,Bridge(${CALLER_CHAN_ID})

But here I got bunch of other bugs, like codec renegotiation on caller leg is failed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.