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

Function ospReportUsageWork

modules/osp/osptoolkit.c:134–187  ·  view source on GitHub ↗

* Report OSP usage thread function * param usagearg OSP usage information * return */

Source from the content-addressed store, hash-verified

132 * return
133 */
134static OSPTTHREADRETURN ospReportUsageWork(
135 void* usagearg)
136{
137 int i;
138 const int MAX_RETRIES = 5;
139 osp_usage* usage;
140 int errorcode;
141
142 usage = (osp_usage*)usagearg;
143
144 OSPPTransactionRecordFailure(
145 usage->transaction,
146 usage->cause);
147
148#if 0
149 OSPPTransactionSetTermCause(
150 usage->transaction,
151 OSPC_TCAUSE_SIP,
152 usage->cause,
153 NULL);
154#endif
155
156 for (i = 1; i <= MAX_RETRIES; i++) {
157 errorcode = OSPPTransactionReportUsage(
158 usage->transaction,
159 usage->duration,
160 usage->start,
161 usage->end,
162 usage->alert,
163 usage->connect,
164 usage->haspdd,
165 usage->pdd * 1000,
166 usage->release,
167 NULL, -1, -1, -1, -1, NULL, NULL);
168
169 if (errorcode == OSPC_ERR_NO_ERROR) {
170 LM_DBG("reporte usage for '%llu'\n",
171 ospGetTransactionId(usage->transaction));
172 break;
173 } else {
174 LM_ERR("failed to report usage for '%llu' (%d) attempt '%d' of '%d'\n",
175 ospGetTransactionId(usage->transaction),
176 errorcode,
177 i,
178 MAX_RETRIES);
179 }
180 }
181
182 OSPPTransactionDelete(usage->transaction);
183
184 free(usage);
185
186 OSPTTHREADRETURN_NULL();
187}

Callers

nothing calls this directly

Calls 1

ospGetTransactionIdFunction · 0.85

Tested by

no test coverage detected