Equivalent of SIP_CODEC with PJSIP

Hi. Which dialplan command equivalent to Set(__SIP_CODEC=mycodec) could be used to change codec on the fly with PJSIP ?

That would be PJSIP_MEDIA_OFFER[1].

[1] Asterisk 20 Function_PJSIP_MEDIA_OFFER - Asterisk Project - Asterisk Project Wiki

[jcolp] jcolp https://community.asterisk.org/u/jcolp Asterisk
Project Lead
February 24

That would be PJSIP_MEDIA_OFFER[1].

[1] Asterisk 20 Function_PJSIP_MEDIA_OFFER - Asterisk Project -
Asterisk Project Wiki
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Function_PJSIP_MEDIA_OFFER

Thanks Josh, but

zone-s*CLI> dialplan eval function pjsip_media_offer
Return Value: Failure (-1)
Result:
[2023-02-24 17:24:26] WARNING[3516200]: pbx_functions.c:453 func_args:
Function ‘pjsip_media_offer’ doesn’t contain parentheses. Assuming null
argument.
[2023-02-24 17:24:26] ERROR[3516200]: pbx_functions.c:608 ast_func_read:
Function pjsip_media_offer not registered

Asterisk 20.1.0 compiled from source As well as in menuselect as in
/usr/lib/asterisk/modules I can find a function or resource like this.
Same with 18.16.0 or 18.14.0 from freepbx

Any clue ?

That’s for evaluating a dialplan function, which won’t work. It’s also not being used correctly. Capitalization matters. PJSIP_MEDIA_OFFER.

*CLI> core show functions like PJSIP_MEDIA_OFFER
Matching Custom Functions:
--------------------------------------------------------------------------------
PJSIP_MEDIA_OFFER     PJSIP_MEDIA_OFFER(media)             Media and codec offerings to be set on an outbound SIP channel prior to dialing. 
1 matching custom functions installed.

And then for details:

*CLI> core show function PJSIP_MEDIA_OFFER 

  -= Info about function 'PJSIP_MEDIA_OFFER' =- 

[Synopsis]
Media and codec offerings to be set on an outbound SIP channel prior to
dialing. 

[Description]
When read, returns the codecs offered based upon the media choice.
When written, sets the codecs to offer when an outbound dial attempt is made,
or when a session refresh is sent using <PJSIP_SEND_SESSION_REFRESH>. 

[Syntax]
PJSIP_MEDIA_OFFER(media)

[Arguments]
media
    types of media offered

[See Also]
PJSIP_SEND_SESSION_REFRESH

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