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

Function ospSetCalling

modules/osp/orig_transaction.c:877–916  ·  view source on GitHub ↗

* Set calling number if translated * param msg SIP message * param inbound Inbound info * param dest Destination structure * return 0 success, 1 calling number same or not support calling number translation, -1 failure */

Source from the content-addressed store, hash-verified

875 * return 0 success, 1 calling number same or not support calling number translation, -1 failure
876 */
877static int ospSetCalling(
878 struct sip_msg* msg,
879 osp_inbound* inbound,
880 osp_dest* dest)
881{
882 str rpid;
883 int_str val;
884 char buffer[2 * sizeof dest->calling + sizeof inbound->source + 11];
885 int result;
886
887 if (strcmp(inbound->calling, dest->calling) == 0) {
888 LM_DBG("calling number does not been translated\n");
889 result = 1;
890 } else if (osp_auth.rpid_avp < 0) {
891 LM_WARN("rpid_avp is not found, cannot set rpid avp\n");
892 result = -1;
893 } else {
894 snprintf(buffer,
895 sizeof(buffer),
896 "\"%s\" <sip:%s@%s>",
897 dest->calling,
898 dest->calling,
899 inbound->source);
900
901 rpid.s = buffer;
902 rpid.len = strlen(buffer);
903 add_avp(osp_auth.rpid_avp_type | AVP_VAL_STR, osp_auth.rpid_avp, (int_str)rpid);
904
905 result = 0;
906 }
907
908 if (result == 0) {
909 val.n = 1;
910 } else {
911 val.n = 0;
912 }
913 add_avp(0, _osp_calling_avpid, val);
914
915 return result;
916}
917
918/*
919 * Check if the calling number is translated.

Callers 1

ospPrepareDestinationFunction · 0.85

Calls 1

add_avpFunction · 0.85

Tested by

no test coverage detected