[asterisk-bugs] [JIRA] (ASTERISK-28878) chan_pjsip: PJSIP_MEDIA_OFFER Broken asterisk 16

Kevin Harwell (JIRA) noreply at issues.asterisk.org
Mon Aug 24 16:09:43 CDT 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=251749#comment-251749 ] 

Kevin Harwell commented on ASTERISK-28878:
------------------------------------------

[~jades] I think maybe part of the confusion comes in in that there are two dialplan functions being used in this scenario.

>From the [PJSIP_MEDIA_OFFER|https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_PJSIP_MEDIA_OFFER] description:
{quote}
Media and codec offerings to be set on an outbound SIP channel prior to dialing.
{quote}
Typically, and in order to achieve the described behavior this function is used in a [pre-dial handler|https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers]. For example:
{noformat}
[from-jc-custom]
exten => _2XX,1,NoOp()
exten => _2XX,n,Dial(PJSIP/525${EXTEN},,b(gosub-jc-custom^s^1))
exten => _2XX,n,Hangup()

[gosub-jc-custom]
exten => s,1,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
exten => s,n,Return()
{noformat}
The above dialplan will "override" whatever is configured for endpoint 525, and use g722 in the offer when dialing the "outbound" channel.

The second function being used is [PJSIP_SEND_SESSION_REFRESH|https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_PJSIP_SEND_SESSION_REFRESH]. From its description:
{quote}
Initiate a session refresh via an UPDATE or re-INVITE on an established media session
{quote}
_Established media session_ is the key phrase there. A simple example of that would be after Asterisk answers:
{noformat}
[from-jc-custom]
exten => _2XX,1,NoOp()
exten => _2XX,n,Answer()
exten => _2XX,n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
exten => _2XX,1,Playback(hello-world) ; Do something here
exten => _2XX,n,Hangup()
{noformat}
That dialplan will cause Asterisk to answer the incoming channel (establish the media session), and then send a session refresh (re-invite) back out to the caller.

Now you can combine the the two functions to make it so before sending out the re-invite the media being offered is also updated:
{noformat}
[from-jc-custom]
exten => _2XX,1,NoOp()
exten => _2XX,n,Answer()
exten => _2XX,n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
exten => _2XX,n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
exten => _2XX,1,Playback(hello-world) ; Do something here
exten => _2XX,n,Hangup()
{noformat}
Things get a little more tricky if you'd like to be able to refresh the session post [Dial|https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Application_Dial]. You'll either need to use some post dial handler mechanism (not sure a good one exists for that), or use some combination of Dial, [Local Channels|https://wiki.asterisk.org/wiki/display/AST/Local+Channel], [Originate|https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Application_Originate], and/or [Bridge|https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Application_Bridge].

Hope that helps.

> chan_pjsip: PJSIP_MEDIA_OFFER Broken asterisk 16
> ------------------------------------------------
>
>                 Key: ASTERISK-28878
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28878
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_pjsip
>    Affects Versions: 16.4.0, 16.10.0
>            Reporter: Joseph Ades
>            Assignee: Kevin Harwell
>            Severity: Minor
>      Target Release: 13.35.0, 16.12.0, 17.6.0
>
>         Attachments: asterisk13-Working.pcap, asterisk13-working.txt, asterisk16-12-notworking.txt, asterisk16-NOT-WORKING.pcap, Code.txt, verbose13.txt, verbose16.txt
>
>
> I am migrating from asterisk 13 and have successfully utilized the pjsip_media_offer function. Very simple code, not much else to it, and worked for years.
> https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_PJSIP_MEDIA_OFFER
> After testing an asterisk 16 machine, using exactly the same code, I am unable to get it to work. The CLI reads the code, but does not do anything with it. Furthermore, after analyzing the packet capture, there is no evidence of the asterisk machine sending an INVITE to renegotiate the codec.
> I downgraded back to asterisk 13 and everything started to work again



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list