comparison sip-in/invite.c @ 108:0d6435808bcd

sip-in: implement 100rel for 180 Ringing response
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Sep 2022 14:29:10 -0800
parents 372209628038
children 9b87894704eb
comparison
equal deleted inserted replaced
107:372209628038 108:0d6435808bcd
345 fill_invite_resp_from_call(&resp, call); 345 fill_invite_resp_from_call(&resp, call);
346 out_msg_finish(&resp); 346 out_msg_finish(&resp);
347 sip_tx_packet(&resp, sin); 347 sip_tx_packet(&resp, sin);
348 return; 348 return;
349 case SIP_STATE_RINGING: 349 case SIP_STATE_RINGING:
350 case SIP_STATE_RINGING_PRACK:
351 start_response_out_msg(&resp, "180 Ringing"); 350 start_response_out_msg(&resp, "180 Ringing");
352 fill_invite_resp_from_call(&resp, call); 351 fill_invite_resp_from_call(&resp, call);
352 out_msg_finish(&resp);
353 sip_tx_packet(&resp, sin);
354 return;
355 case SIP_STATE_RINGING_REL:
356 start_response_out_msg(&resp, "180 Ringing");
357 fill_invite_resp_from_call(&resp, call);
358 out_msg_add_header(&resp, "Require", "100rel");
359 out_msg_add_header(&resp, "RSeq", "1");
353 out_msg_finish(&resp); 360 out_msg_finish(&resp);
354 sip_tx_packet(&resp, sin); 361 sip_tx_packet(&resp, sin);
355 return; 362 return;
356 case SIP_STATE_INVITE_200: 363 case SIP_STATE_INVITE_200:
357 case SIP_STATE_CONNECTED: 364 case SIP_STATE_CONNECTED:
388 void 395 void
389 signal_invite_ringing(call) 396 signal_invite_ringing(call)
390 struct call *call; 397 struct call *call;
391 { 398 {
392 struct sip_msg_out resp; 399 struct sip_msg_out resp;
400 int rc;
393 401
394 start_response_out_msg(&resp, "180 Ringing"); 402 start_response_out_msg(&resp, "180 Ringing");
395 fill_invite_resp_from_call(&resp, call); 403 rc = fill_invite_resp_from_call(&resp, call);
404 if (rc < 0) {
405 msg_size_err: syslog(LOG_ERR, "INVITE 180 response length exceeded");
406 call->sip_state = SIP_STATE_MSG_SIZE_ERR;
407 call->overall_state = OVERALL_STATE_TEARDOWN;
408 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
409 GSM48_CC_CAUSE_INTERWORKING);
410 disconnect_tmgw(call);
411 /* TODO: transition from TEARDOWN to DEAD_SIP */
412 return;
413 }
414 if (call->use_100rel) {
415 rc = out_msg_add_header(&resp, "Require", "100rel");
416 if (rc < 0)
417 goto msg_size_err;
418 rc = out_msg_add_header(&resp, "RSeq", "1");
419 if (rc < 0)
420 goto msg_size_err;
421 }
396 out_msg_finish(&resp); 422 out_msg_finish(&resp);
397 sip_tx_packet(&resp, &call->udp_sin); 423 sip_tx_packet(&resp, &call->udp_sin);
398 call->sip_state = SIP_STATE_RINGING; 424 if (call->use_100rel) {
425 call->sip_state = SIP_STATE_RINGING_REL;
426 call->sip_tx_count = 1;
427 } else
428 call->sip_state = SIP_STATE_RINGING;
399 } 429 }
400 430
401 void 431 void
402 signal_invite_200(call) 432 signal_invite_200(call)
403 struct call *call; 433 struct call *call;