How to execute a command when b-leg answer

I want to implement a function to execute a command when b-leg just Answer(). I tried this:

same => n,Dial(SIP/Partener/${CALLERID(dnid)},,M(BLeg-Answer^${ARG}))

but it doesn’t work. It seems that the specified command is executed before b-leg Answer().
How to implement this function?

Macros are deprecated. and, I believe disabled, by default in all currently supported versions . You should use U.

chan_sip is deprecated and disabled by default in all supported versions except 16.

Both will be removed in Autumn of next year.

I don’t think CALLERID(dnid) is set by the system, so I don’t think that will work unless you set it yourself. Normally, in such contexts, the extension number carries the information you want there.

Without seeing the definitions of BLeg-Answer and the setting of variable ARG, and sufficiently detailed logs of the failure, it is not possible to say what else might be wrong/

U is a substitute for M, and the timing of execution is the same as M, right? I know that chan_sip and macro have been abandoned, we are using Asterisk v13.38.3 and there is no plan to upgrade yet.

U uses subroutines Both macros and subroutines are interpreted at run time, using the same basic interpreter, so should not have significant timing differences.

Security fixes for Asterisk 13 ceased three months ago.

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