comparison sip-out/invite.c @ 158:51cf5ea7f320

sip-out: map INVITE errors to GSM cause values
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2022 08:45:39 -0800
parents 7643b779dbea
children bfa9f0c0f0ac
comparison
equal deleted inserted replaced
157:7643b779dbea 158:51cf5ea7f320
228 call->sip_state, msg->status_code); 228 call->sip_state, msg->status_code);
229 exit(1); 229 exit(1);
230 } 230 }
231 } 231 }
232 232
233 static int
234 sip_error_to_gsm_cause(sip_status_code)
235 unsigned sip_status_code;
236 {
237 /* mapping taken from osmo-sip-connector */
238 switch (sip_status_code) {
239 case 400:
240 return GSM48_CC_CAUSE_TEMP_FAILURE;
241 case 401:
242 case 402:
243 case 403:
244 return GSM48_CC_CAUSE_CALL_REJECTED;
245 case 404:
246 return GSM48_CC_CAUSE_UNASSIGNED_NR;
247 case 405:
248 return GSM48_CC_CAUSE_SERV_OPT_UNAVAIL;
249 case 406:
250 return GSM48_CC_CAUSE_CHAN_UNACCEPT;
251 case 407:
252 return GSM48_CC_CAUSE_CALL_REJECTED;
253 case 408:
254 return GSM48_CC_CAUSE_RECOVERY_TIMER;
255 case 410:
256 return GSM48_CC_CAUSE_NUMBER_CHANGED;
257 case 413:
258 case 414:
259 return GSM48_CC_CAUSE_INTERWORKING;
260 case 415:
261 return GSM48_CC_CAUSE_SERV_OPT_UNIMPL;
262 case 416:
263 return GSM48_CC_CAUSE_INVAL_TRANS_ID;
264 case 420:
265 case 421:
266 case 423:
267 return GSM48_CC_CAUSE_INTERWORKING;
268 case 480:
269 return GSM48_CC_CAUSE_USER_NOTRESPOND;
270 case 481:
271 return GSM48_CC_CAUSE_TEMP_FAILURE;
272 case 482:
273 case 483:
274 return GSM48_CC_CAUSE_PRE_EMPTION;
275 case 484:
276 return GSM48_CC_CAUSE_INV_NR_FORMAT;
277 case 485:
278 return GSM48_CC_CAUSE_NO_ROUTE;
279 case 486:
280 return GSM48_CC_CAUSE_USER_BUSY;
281 case 488:
282 return GSM48_CC_CAUSE_INCOMPAT_DEST;
283 case 500:
284 return GSM48_CC_CAUSE_TEMP_FAILURE;
285 case 501:
286 return GSM48_CC_CAUSE_SERV_OPT_UNIMPL;
287 case 502:
288 return GSM48_CC_CAUSE_DEST_OOO;
289 case 503:
290 return GSM48_CC_CAUSE_RESOURCE_UNAVAIL;
291 case 504:
292 return GSM48_CC_CAUSE_RECOVERY_TIMER;
293 case 505:
294 case 513:
295 return GSM48_CC_CAUSE_INTERWORKING;
296 case 600:
297 return GSM48_CC_CAUSE_USER_BUSY;
298 case 603:
299 return GSM48_CC_CAUSE_CALL_REJECTED;
300 case 604:
301 return GSM48_CC_CAUSE_NO_ROUTE;
302 case 606:
303 return GSM48_CC_CAUSE_INCOMPAT_DEST;
304 default:
305 return GSM48_CC_CAUSE_NORMAL_UNSPEC;
306 }
307 }
308
233 static void 309 static void
234 handle_error(call, msg, tag, sin) 310 handle_error(call, msg, tag, sin)
235 struct call *call; 311 struct call *call;
236 struct sip_pkt_rx *msg; 312 struct sip_pkt_rx *msg;
237 char *tag; 313 char *tag;