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

Function m_store

modules/msilo/msilo.c:446–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444 */
445
446static int m_store(struct sip_msg* msg, str* owner)
447{
448 str body, str_hdr, ctaddr;
449 struct to_body *pto, *pfrom;
450 struct sip_uri puri;
451 str duri;
452 db_key_t db_keys[NR_KEYS-1];
453 db_val_t db_vals[NR_KEYS-1];
454 db_key_t db_cols[1];
455 db_res_t* res = NULL;
456 int nr_keys = 0, val, lexpire;
457#define MS_BUF1_SIZE 1024
458 static char ms_buf1[MS_BUF1_SIZE];
459 str notify_from;
460 str notify_body;
461 str notify_ctype;
462 str notify_contact;
463
464 int_str avp_value;
465 struct usr_avp *avp;
466
467 /* get message body - after that whole SIP MESSAGE is parsed */
468 if ( get_body( msg, &body)!=0 )
469 {
470 LM_ERR("cannot extract body from msg\n");
471 goto error;
472 }
473 /* missing body is not an error here as we can have
474 * requests with external bodies (refered from content-type hdr) */
475
476 /* get TO URI */
477 if(!msg->to || !msg->to->body.s)
478 {
479 LM_ERR("cannot find 'to' header!\n");
480 goto error;
481 }
482
483 pto = get_to(msg);
484 if (pto == NULL || pto->error != PARSE_OK) {
485 LM_ERR("failed to parse TO header\n");
486 goto error;
487 }
488
489 /* get the owner */
490 memset(&puri, 0, sizeof(struct sip_uri));
491 if(owner)
492 {
493 if(parse_uri(owner->s, owner->len, &puri)!=0)
494 {
495 LM_ERR("bad owner SIP address!\n");
496 goto error;
497 } else {
498 LM_DBG("using user id [%.*s]\n", owner->len, owner->s);
499 }
500 } else { /* get it from R-URI */
501 if(msg->new_uri.len <= 0)
502 {
503 if(msg->first_line.u.request.uri.len <= 0)

Callers

nothing calls this directly

Calls 7

get_bodyFunction · 0.85
parse_uriFunction · 0.85
parse_from_headerFunction · 0.85
search_first_avpFunction · 0.85
ms_extract_timeFunction · 0.85
pv_printf_sFunction · 0.85
parse_contactFunction · 0.85

Tested by

no test coverage detected