Fixed the issue of pjsip Persistent phone calls.

Source: Internet
Author: User

When a calls B, if B has already connected the phone, but 200 OK has not returned to a, but a hangs up the phone
1. A sends Cancel to B.
2. A receives the 200 OK message from invite, replies to ACK, and sets the call to active.
3. B receives the cancel and replies to the 200 OK message, but does not send the 487
(Normal cancel process reference http://yeyingxian.blog.163.com/blog/static/344712420130238404943)


A opensips B


====> Invite
====> Invite
<=== 100 trying


<==== 200 OK (invite)
====> Cancel
====> Cancel
<==== 200 OK (invite)
====> ACK
<= 200 OK (cancel)
<= 200 OK (cancel)
====> ACK


Sequence Chart

 


The result is that a wants to stop the call, but the call is secretly connected.
Correction Method: When a is in the cancel process, if the 200 OK message is received, the bye message is sent to cancel the session.


Inv_set_state in sip_inv.c

 


If (pjmedia_sdp_neg_get_state (INV-> NEG )! = Pjmedia_sdp_neg_state_done &&
(Tsx_inv_data &&! Tsx_inv_data-> sdp_done ))
{
Pjsip_tx_data * Bye;


Pj_log (4, (INV-> obj_name, "SDP offer/Answer incomplete, ending"
"Session "));


Status = pjsip_inv_end_session (INV, pjsip_ SC _not_acceptable,
Null, & bye );
If (status = pj_success & bye)
Status = pjsip_inv_send_msg (INV, bye );


Return;
}


+ If (INV-> canceling)
+ {
+ Pjsip_tx_data * Bye;
+
+ Pj_log (4, (INV-> obj_name, "end session, because cancellation is in progress "));
+
+ Status = pjsip_inv_end_session (INV, pjsip_ SC _not_acceptable,
+ Null, & bye );
+ If (status = pj_success & bye)
+ Status = pjsip_inv_send_msg (INV, bye );
+
+ Return;
+}
}


/* Set state .*/
Inv-> state = State;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.