[asterisk-bugs] [JIRA] (ASTERISK-24835) Early Media Not working with Chan SIP and Asterisk 13

Andrew Nagy (JIRA) noreply at issues.asterisk.org
Thu Feb 26 20:25:34 CST 2015


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

Andrew Nagy commented on ASTERISK-24835:
----------------------------------------

I believe I have narrowed down the offending line of code to be

Asterisk Branch 13 (channels/chan_sip.c)
{code}
	case AST_CONTROL_PROGRESS:
		if ((ast_channel_state(ast) != AST_STATE_UP) &&
		    !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
		    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
			p->invitestate = INV_EARLY_MEDIA;
			/* SIP_PROG_INBAND_NEVER means sending 180 ringing in place of a 183 */
			if (ast_test_flag(&p->flags[0], SIP_PROG_INBAND) != SIP_PROG_INBAND_NEVER) {
				transmit_provisional_response(p, "183 Session Progress", &p->initreq, TRUE);
				ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
			} else if (ast_channel_state(ast) == AST_STATE_RING && !ast_test_flag(&p->flags[0], SIP_RINGING)) {
				transmit_provisional_response(p, "180 Ringing", &p->initreq, 0);
				ast_set_flag(&p->flags[0], SIP_RINGING);
			}
			break;
		}
		res = -1;
		break;
{code}

Asterisk Branch 11 (channels/chan_sip.c)
{code}
	case AST_CONTROL_PROGRESS:
		if ((ast_channel_state(ast) != AST_STATE_UP) &&
		    !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
		    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
			p->invitestate = INV_EARLY_MEDIA;
			transmit_provisional_response(p, "183 Session Progress", &p->initreq, TRUE);
			ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
			break;
		}
		res = -1;
		break;
{code}

Which to me looks like I need to set "progressinband" to "yes" instead of the default "never". So I assume this was a change to Chan_SIP at some point. Seems like a pretty big change from the past?

> Early Media Not working with Chan SIP and Asterisk 13
> -----------------------------------------------------
>
>                 Key: ASTERISK-24835
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24835
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_sip/General
>    Affects Versions: 13.1.1
>            Reporter: Andrew Nagy
>            Severity: Critical
>         Attachments: chanpjsip.txt, chansip.txt, dialplan.txt
>
>
> Early media is not working in Asterisk 13 when using Chan_SIP. It works fine when using PJSIP. The reasoning appears to be that Chan_SIP is sending 180 ringing when it's told to "Progress" while PJSIP is sending 183 when it's told to progress.
> I have attached a log of a chan_sip dial and a pjsip dial. You will see the differences there in. Specifically:
> CHAN_SIP (13):
> {code}
>     -- Executing [999 at from-internal:3] Progress("SIP/1002-00000085", "") in new stack
> <--- Transmitting (NAT) to 66.185.28.100:5064 --->
> SIP/2.0 180 Ringing
> Via: SIP/2.0/UDP 10.10.10.12:5064;branch=z9hG4bK2113418340;received=66.185.28.100;rport=5064
> From: <sip:1002 at freepbxdev1.schmoozecom.net:5061>;tag=706301242
> To: <sip:999 at freepbxdev1.schmoozecom.net:5061>;tag=as3db28b80
> Call-ID: 2099708635-5064-5 at BA.BA.BA.BC
> CSeq: 41 INVITE
> Server: FPBX-13.0.1alpha1(13.1.1)
> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
> Supported: replaces, timer
> Session-Expires: 1800;refresher=uas
> Contact: <sip:999 at 199.102.239.103:5061>
> Content-Length: 0
> <------------>
> {code}
> CHAN_PJSIP (13):
> {code}
>     -- Executing [999 at from-internal:3] Progress("PJSIP/1001-000000aa", "") in new stack
> <--- Transmitting SIP response (827 bytes) to UDP:66.185.28.100:5060 --->
> SIP/2.0 183 Session Progress
> Via: SIP/2.0/UDP 10.10.10.12:5060;rport=5060;received=66.185.28.100;branch=z9hG4bK503980922
> Call-ID: 70708105-5060-5 at BA.BA.BA.BC
> From: "Andrew Nagy" <sip:1001 at freepbxdev1.schmoozecom.net>;tag=1590118380
> To: <sip:999 at freepbxdev1.schmoozecom.net>;tag=AvwkMijOGvO1QXW1qDcNXl8xlBqUW.Ux
> CSeq: 41 INVITE
> Server: FPBX-13.0.1alpha1(13.1.1)
> Contact: <sip:199.102.239.103:5065>
> Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REGISTER, REFER
> Content-Type: application/sdp
> Content-Length:   255
> v=0
> o=- 8004 8002 IN IP4 199.102.239.103
> s=Asterisk
> c=IN IP4 199.102.239.103
> t=0 0
> m=audio 14388 RTP/AVP 0 8 101
> a=rtpmap:0 PCMU/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-16
> a=ptime:20
> a=maxptime:150
> a=sendrecv
> {code}
> CHAN_SIP(11.16.0)
> {code}
>     -- Executing [999 at from-internal:3] Progress("SIP/1002-00000001", "") in new stack
> Audio is at 12696
> Adding codec 100003 (ulaw) to SDP
> Adding codec 100004 (alaw) to SDP
> Adding non-codec 0x1 (telephone-event) to SDP
> <--- Transmitting (NAT) to 66.185.28.100:5064 --->
> SIP/2.0 183 Session Progress
> Via: SIP/2.0/UDP 10.10.10.12:5064;branch=z9hG4bK1753731864;received=66.185.28.100;rport=5064
> From: <sip:1002 at freepbxdev1.schmoozecom.net:5061>;tag=9700035
> To: <sip:999 at freepbxdev1.schmoozecom.net:5061>;tag=as5bd4933a
> Call-ID: 1953294974-5064-7 at BA.BA.BA.BC
> CSeq: 61 INVITE
> Server: FPBX-13.0.1alpha1(13.1.1)
> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
> Supported: replaces, timer
> Session-Expires: 1800;refresher=uas
> Contact: <sip:999 at 199.102.239.103:5061>
> Content-Type: application/sdp
> Require: timer
> Content-Length: 264
> v=0
> o=root 424885368 424885368 IN IP4 199.102.239.103
> s=Asterisk PBX 11.16.0
> c=IN IP4 199.102.239.103
> t=0 0
> m=audio 12696 RTP/AVP 0 8 101
> a=rtpmap:0 PCMU/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-16
> a=ptime:20
> a=sendrecv
> <------------>
> {code}
> The above logs were generated from the dialplan below
> {code}
> [bad-number]
> include => bad-number-custom
> exten => _X.,1,ResetCDR()
> exten => _X.,n,NoCDR()
> exten => _X.,n,Progress
> exten => _X.,n,Wait(1)
> exten => _X.,n,Progress
> exten => _X.,n,Playback(silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer)
> exten => _X.,n,Wait(1)
> exten => _X.,n,Congestion(20)
> exten => _X.,n,Hangup
> {code}
> I have, however, attached a simplified dialplan for testing in the attachments.



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



More information about the asterisk-bugs mailing list