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

Function ospRecordTransaction

modules/osp/usage.c:100–174  ·  view source on GitHub ↗

* Create OSP cookie and insert it into Record-Route header * param msg SIP message * param tansid Transaction ID * param inbound Inbound info * param dest Destination * param isorig Originate / Terminate */

Source from the content-addressed store, hash-verified

98 * param isorig Originate / Terminate
99 */
100static void ospRecordTransaction(
101 struct sip_msg* msg,
102 osp_inbound* inbound,
103 osp_dest* dest,
104 int isorig)
105{
106 str cookie;
107 char buffer1[OSP_STRBUF_SIZE];
108 char buffer2[OSP_STRBUF_SIZE];
109
110 if (osp_rr.add_rr_param == 0) {
111 LM_WARN("add_rr_param function is not found, cannot record information about the OSP transaction\n");
112 return;
113 }
114
115 cookie.s = buffer1;
116
117 if (isorig == 1) {
118 cookie.len = snprintf(
119 buffer1,
120 sizeof(buffer1),
121 ";%s=%c%llu_%c%s_%c%d_%c%d",
122 OSP_ORIG_COOKIE,
123 OSP_COOKIE_TRANSID,
124 dest->transid,
125 OSP_COOKIE_SRCIP,
126 inbound->srcdev,
127 OSP_COOKIE_AUTHTIME,
128 (unsigned int)inbound->authtime,
129 OSP_COOKIE_DCOUNT,
130 dest->destcount);
131 } else {
132 cookie.len = snprintf(
133 buffer1,
134 sizeof(buffer1),
135 ";%s=%c%llu_%c%s_%c%d",
136 OSP_TERM_COOKIE,
137 OSP_COOKIE_TRANSID,
138 dest->transid,
139 OSP_COOKIE_SRCIP,
140 inbound->source,
141 OSP_COOKIE_AUTHTIME,
142 (unsigned int)inbound->authtime);
143 }
144 if ((_osp_report_nid & OSP_REPORT_SNID) && inbound->snid[0]) {
145 cookie.len = snprintf(
146 buffer2,
147 sizeof(buffer2),
148 "%s_%c%s",
149 buffer1,
150 OSP_COOKIE_SNID,
151 inbound->snid);
152 strncpy(buffer1, buffer2, sizeof(buffer1));
153 buffer1[sizeof(buffer1) - 1] = '\0';
154 }
155 if ((_osp_report_nid & OSP_REPORT_DNID) && dest->dnid[0]) {
156 cookie.len = snprintf(
157 buffer2,

Callers 2

ospRecordOrigTransactionFunction · 0.85
ospRecordTermTransactionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected