Hello All. I.m found, if I reject unwanted SDP offer in incoming re-INVITE with "488 Not Acceptable Here", this re-INVITE request is not canceled.. And to the all next incoming re-INVITE request pjsip answer with "491 Request Pending" response. I check inv_respond_incoming_update() function and copy/paste some code from there to inv_on_state_confirmed(). This is my simple patch for this issue: Index: pjsip/src/pjsip-ua/sip_inv.c =================================================================== --- pjsip/src/pjsip-ua/sip_inv.c (revision 3546) +++ pjsip/src/pjsip-ua/sip_inv.c (working copy) @@ -4012,7 +4012,16 @@ /* Not Acceptable */ const pjsip_hdr *accept; + pjmedia_sdp_neg_state neg_state; + /* Negotiation has failed. If negotiator is still + * stuck at non-DONE state, cancel any ongoing offer. + */ + neg_state = pjmedia_sdp_neg_get_state(inv->neg); + if (neg_state != PJMEDIA_SDP_NEG_STATE_DONE) { + pjmedia_sdp_neg_cancel_offer(inv->neg); + } + status = pjsip_dlg_create_response(inv->dlg, rdata, 488, NULL, &tdata); if (status != PJ_SUCCESS) This is log file for demonstrate this issue: 5:13:55.309 sip_endpoint.c Processing incoming message: Request msg INVITE/cseq=102 (rdata0x4a035c) 15:13:55.311 pjsua_core.c RX 931 bytes Request msg INVITE/cseq=102 (rdata0x4a035c) from UDP 192.168.1.1:5060: INVITE sip:0002 at 192.168.1.150:5062;ob SIP/2.0 Via: SIP/2.0/UDP 192.168.1.1:5060;branch=z9hG4bK4eefc1f3;rport Max-Forwards: 70 From: sip:1234@192.168.1.1;tag=as754d39d7 To: "0002" <sip:0002 at 192.168.1.1>;tag=.rDK5s8dz8gPP4CdXR97JDtmOL-wNGnn Contact: <sip:1234 at 192.168.1.1> Call-ID: 0D4Of6O0y5DNQm.ePpHxf1ViVC-Rf8DA CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.17 Require: timer Session-Expires: 1800;refresher=uas Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 337 v=0 o=root 1792911631 1792911634 IN IP4 192.168.1.1 s=Asterisk PBX 1.6.1.17 c=IN IP4 192.168.1.1 t=0 0 m=image 4972 udptl t38 a=T38FaxVersion:0 a=T38MaxBitRate:14400 a=T38FaxFillBitRemoval a=T38FaxTranscodingMMR a=T38FaxTranscodingJBIG a=T38FaxRateManagement:transferredTCF a=T38FaxMaxDatagram:1400 a=T38FaxUdpEC:t38UDPFEC --end msg-- 15:13:55.315 dlg0x459a94 Received Request msg INVITE/cseq=102 (rdata0x4a035c) 15:13:55.317 tsx0x462094 Transaction created for Request msg INVITE/cseq=102 (rdata0x4a035c) 15:13:55.321 tsx0x462094 Incoming Request msg INVITE/cseq=102 (rdata0x4a035c) in state Null 15:13:55.322 tsx0x462094 State changed from Null to Trying, event=RX_MSG 15:13:55.324 dlg0x459a94 Transaction tsx0x462094 state changed to Trying 15:13:55.327 inv0x459a94 Got SDP offer in Request msg INVITE/cseq=102 (rdata0x4a035c) Call received updated media offer 15:13:55.330 pjsua_call.c Unable to create local SDP: Unsupported address family (PJ_EAFNOTSUP) [status=70022] 15:13:55.331 endpoint Response msg 488/INVITE/cseq=102 (tdta0x44d9e8) created 15:13:55.333 dlg0x459a94 Sending Response msg 488/INVITE/cseq=102 (tdta0x44d9e8) 15:13:55.336 tsx0x462094 Sending Response msg 488/INVITE/cseq=102 (tdta0x44d9e8) in state Trying 15:13:55.338 pjsua_core.c TX 377 bytes Response msg 488/INVITE/cseq=102 (tdta0x44d9e8) to UDP 192.168.1.1:5060: SIP/2.0 488 Not Acceptable Here Via: SIP/2.0/UDP 192.168.1.1:5060;rport=5060;received=192.168.1.1;branch=z9hG4bK4eefc1f3 Call-ID: 0D4Of6O0y5DNQm.ePpHxf1ViVC-Rf8DA From: <sip:1234@192.168.1.1>;tag=as754d39d7 To: "0002" <sip:0002 at 192.168.1.1>;tag=.rDK5s8dz8gPP4CdXR97JDtmOL-wNGnn CSeq: 102 INVITE Accept: application/sdp, message/sipfrag;version=2.0 Content-Length: 0 --end msg-- 15:13:55.341 tsx0x462094 State changed from Trying to Completed, event=TX_MSG 15:13:55.345 dlg0x459a94 Transaction tsx0x462094 state changed to Completed 15:13:55.348 sip_endpoint.c Processing incoming message: Request msg ACK/cseq=102 (rdata0x4a035c) 15:13:55.351 pjsua_core.c RX 388 bytes Request msg ACK/cseq=102 (rdata0x4a035c) from UDP 192.168.1.1:5060: ACK sip:0002 at 192.168.1.150:5062;ob SIP/2.0 Via: SIP/2.0/UDP 192.168.1.1:5060;branch=z9hG4bK4eefc1f3;rport Max-Forwards: 70 From: sip:1234@192.168.1.1;tag=as754d39d7 To: "0002" <sip:0002 at 192.168.1.1>;tag=.rDK5s8dz8gPP4CdXR97JDtmOL-wNGnn Contact: <sip:1234 at 192.168.1.1> Call-ID: 0D4Of6O0y5DNQm.ePpHxf1ViVC-Rf8DA CSeq: 102 ACK User-Agent: Asterisk PBX 1.6.1.17 Content-Length: 0 --end msg-- 15:13:55.356 tsx0x462094 Incoming Request msg ACK/cseq=102 (rdata0x4a035c) in state Completed 15:13:55.359 tsx0x462094 State changed from Completed to Confirmed, event=RX_MSG 15:13:55.360 dlg0x459a94 Transaction tsx0x462094 state changed to Confirmed 15:13:55.363 sip_endpoint.c Processing incoming message: Request msg INVITE/cseq=103 (rdata0x4a035c) 15:13:55.368 pjsua_core.c RX 856 bytes Request msg INVITE/cseq=103 (rdata0x4a035c) from UDP 192.168.1.1:5060: INVITE sip:0002 at 192.168.1.150:5062;ob SIP/2.0 Via: SIP/2.0/UDP 192.168.1.1:5060;branch=z9hG4bK13c06a3d;rport Max-Forwards: 70 From: sip:1234@192.168.1.1;tag=as754d39d7 To: "0002" <sip:0002 at 192.168.1.1>;tag=.rDK5s8dz8gPP4CdXR97JDtmOL-wNGnn Contact: <sip:1234 at 192.168.1.1> Call-ID: 0D4Of6O0y5DNQm.ePpHxf1ViVC-Rf8DA CSeq: 103 INVITE User-Agent: Asterisk PBX 1.6.1.17 Require: timer Session-Expires: 1800;refresher=uas Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 262 v=0 o=root 1792911631 1792911635 IN IP4 192.168.1.1 s=Asterisk PBX 1.6.1.17 c=IN IP4 192.168.1.1 t=0 0 m=audio 17878 RTP/AVP 8 101 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv --end msg-- 15:13:55.370 dlg0x459a94 Received Request msg INVITE/cseq=103 (rdata0x4a035c) 15:13:55.376 tsx0x46289c Transaction created for Request msg INVITE/cseq=103 (rdata0x4a035c) 15:13:55.378 tsx0x46289c Incoming Request msg INVITE/cseq=103 (rdata0x4a035c) in state Null 15:13:55.380 tsx0x46289c State changed from Null to Trying, event=RX_MSG 15:13:55.382 dlg0x459a94 Transaction tsx0x46289c state changed to Trying 15:13:55.385 endpoint Response msg 491/INVITE/cseq=103 (tdta0x446008) created 15:13:55.386 dlg0x459a94 Sending Response msg 491/INVITE/cseq=103 (tdta0x446008) 15:13:55.390 tsx0x46289c Sending Response msg 491/INVITE/cseq=103 (tdta0x446008) in state Trying 15:13:55.393 pjsua_core.c TX 319 bytes Response msg 491/INVITE/cseq=103 (tdta0x446008) to UDP 192.168.1.1:5060: SIP/2.0 491 Request Pending Via: SIP/2.0/UDP 192.168.1.1:5060;rport=5060;received=192.168.1.1;branch=z9hG4bK13c06a3d Call-ID: 0D4Of6O0y5DNQm.ePpHxf1ViVC-Rf8DA From: <sip:1234@192.168.1.1>;tag=as754d39d7 To: "0002" <sip:0002 at 192.168.1.1>;tag=.rDK5s8dz8gPP4CdXR97JDtmOL-wNGnn CSeq: 103 INVITE Content-Length: 0 --end msg-- 15:13:55.397 tsx0x46289c State changed from Trying to Completed, event=TX_MSG 15:13:55.399 dlg0x459a94 Transaction tsx0x46289c state changed to Completed 15:13:55.402 sip_endpoint.c Processing incoming message: Request msg ACK/cseq=103 (rdata0x4a035c) 15:13:55.405 pjsua_core.c RX 388 bytes Request msg ACK/cseq=103 (rdata0x4a035c) from UDP 192.168.1.1:5060: ACK sip:0002 at 192.168.1.150:5062;ob SIP/2.0 Via: SIP/2.0/UDP 192.168.1.1:5060;branch=z9hG4bK13c06a3d;rport Max-Forwards: 70 From: sip:1234@192.168.1.1;tag=as754d39d7 To: "0002" <sip:0002 at 192.168.1.1>;tag=.rDK5s8dz8gPP4CdXR97JDtmOL-wNGnn Contact: <sip:1234 at 192.168.1.1> Call-ID: 0D4Of6O0y5DNQm.ePpHxf1ViVC-Rf8DA CSeq: 103 ACK User-Agent: Asterisk PBX 1.6.1.17 Content-Length: 0 --end msg-- 15:13:55.406 tsx0x46289c Incoming Request msg ACK/cseq=103 (rdata0x4a035c) in state Completed 15:13:55.407 tsx0x46289c State changed from Completed to Confirmed, event=RX_MSG 15:13:55.408 dlg0x459a94 Transaction tsx0x46289c state changed to Confirmed 15:13:55.410 tsx0x462094 Timeout timer event 15:13:55.411 tsx0x462094 State changed from Confirmed to Terminated, event=TIMER 15:13:55.416 dlg0x459a94 Transaction tsx0x462094 state changed to Terminated 15:13:55.418 tsx0x46289c Timeout timer event 15:13:55.421 tsx0x46289c State changed from Confirmed to Terminated, event=TIMER 15:13:55.423 dlg0x459a94 Transaction tsx0x46289c state changed to Terminated 15:13:55.436 tsx0x462094 Timeout timer event 15:13:55.438 tsx0x462094 State changed from Terminated to Destroyed, event=TIMER 15:13:55.439 tdta0x44d9e8 Destroying txdata Response msg 488/INVITE/cseq=102 (tdta0x44d9e8) 15:13:55.441 tsx0x462094 Transaction destroyed! 15:13:55.444 tsx0x46289c Timeout timer event 15:13:55.446 tsx0x46289c State changed from Terminated to Destroyed, event=TIMER 15:13:55.447 tdta0x446008 Destroying txdata Response msg 491/INVITE/cseq=103 (tdta0x446008) 15:13:55.449 tsx0x46289c Transaction destroyed! 15:13:55.983 sip_endpoint.c Processing incoming message: Request msg INVITE/cseq=104 (rdata0x4a035c) 15:13:55.985 pjsua_core.c RX 856 bytes Request msg INVITE/cseq=104 (rdata0x4a035c) from UDP 192.168.1.1:5060: INVITE sip:0002 at 192.168.1.150:5062;ob SIP/2.0 Via: SIP/2.0/UDP 192.168.1.1:5060;branch=z9hG4bK16aa00f0;rport Max-Forwards: 70 From: sip:1234@192.168.1.1;tag=as754d39d7 To: "0002" <sip:0002 at 192.168.1.1>;tag=.rDK5s8dz8gPP4CdXR97JDtmOL-wNGnn Contact: <sip:1234 at 192.168.1.1> Call-ID: 0D4Of6O0y5DNQm.ePpHxf1ViVC-Rf8DA CSeq: 104 INVITE User-Agent: Asterisk PBX 1.6.1.17 Require: timer Session-Expires: 1800;refresher=uas Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 262 v=0 o=root 1792911631 1792911636 IN IP4 192.168.1.1 s=Asterisk PBX 1.6.1.17 c=IN IP4 192.168.1.1 t=0 0 m=audio 17878 RTP/AVP 8 101 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv --end msg-- 15:13:55.987 dlg0x459a94 Received Request msg INVITE/cseq=104 (rdata0x4a035c) 15:13:55.991 tsx0x46255c Transaction created for Request msg INVITE/cseq=104 (rdata0x4a035c) 15:13:55.994 tsx0x46255c Incoming Request msg INVITE/cseq=104 (rdata0x4a035c) in state Null 15:13:55.995 tsx0x46255c State changed from Null to Trying, event=RX_MSG 15:13:55.997 dlg0x459a94 Transaction tsx0x46255c state changed to Trying 15:13:56.001 endpoint Response msg 491/INVITE/cseq=104 (tdta0x44d9e8) created 15:13:56.003 dlg0x459a94 Sending Response msg 491/INVITE/cseq=104 (tdta0x44d9e8) 15:13:56.004 tsx0x46255c Sending Response msg 491/INVITE/cseq=104 (tdta0x44d9e8) in state Trying 15:13:56.009 pjsua_core.c TX 319 bytes Response msg 491/INVITE/cseq=104 (tdta0x44d9e8) to UDP 192.168.1.1:5060: SIP/2.0 491 Request Pending Via: SIP/2.0/UDP 192.168.1.1:5060;rport=5060;received=192.168.1.1;branch=z9hG4bK16aa00f0 Call-ID: 0D4Of6O0y5DNQm.ePpHxf1ViVC-Rf8DA From: <sip:1234@192.168.1.1>;tag=as754d39d7 To: "0002" <sip:0002 at 192.168.1.1>;tag=.rDK5s8dz8gPP4CdXR97JDtmOL-wNGnn CSeq: 104 INVITE Content-Length: 0 --end msg-- -- Best Regards, Yuri. Yuri Saltikov mailto: yuri at voiptech.ru