MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / tm_anycast_replicate

Function tm_anycast_replicate

modules/tm/cluster.c:559–586  ·  view source on GitHub ↗

* Replicates a message within a cluster * Returns: * 1: message was successfully replicated * -1: message should not be replicated * -2: message was already replicated to here - avoid loops * -3: internal error - message was not replicated */

Source from the content-addressed store, hash-verified

557 * -3: internal error - message was not replicated
558 */
559int tm_anycast_replicate(struct sip_msg *msg)
560{
561
562 if (msg->REQ_METHOD != METHOD_CANCEL && msg->REQ_METHOD != METHOD_ACK) {
563 LM_DBG("only CANCEL and ACK can be replicated\n");
564 return -1;
565 }
566
567 if (!is_anycast(msg->rcv.bind_address)) {
568 LM_DBG("request not received on an anycast network\n");
569 return -1;
570 }
571
572 if (msg->msg_flags & FL_TM_REPLICATED) {
573 LM_DBG("message already replicated, shouldn't have got here\n");
574 return -2;
575 }
576 if (msg->REQ_METHOD == METHOD_CANCEL && tm_existing_invite_trans(msg))
577 return -1;
578 if (msg->REQ_METHOD == METHOD_ACK && tm_existing_ack_trans(msg))
579 return -1;
580
581 /* we are currently doing auto-CANCEL only for 3261 transactions */
582 if (tm_repl_auto_cancel && msg->REQ_METHOD == METHOD_CANCEL && msg->via1->branch)
583 return tm_replicate_cancel(msg)? 1: -3;
584 else
585 return tm_replicate_broadcast(msg)? 1: -3;
586}
587
588/**
589 * Handles a CANCEL message received over anycast

Callers

nothing calls this directly

Calls 4

tm_existing_invite_transFunction · 0.85
tm_existing_ack_transFunction · 0.85
tm_replicate_cancelFunction · 0.85
tm_replicate_broadcastFunction · 0.85

Tested by

no test coverage detected