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

Function get_dest_user

modules/cpl_c/cpl.c:513–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511
512
513static inline int get_dest_user(struct sip_msg *msg, str *username, str *domain)
514{
515 struct sip_uri uri;
516
517 /* get the user_name from new_uri/RURI/To */
518 LM_DBG("trying to get user from new_uri\n");
519 if ( !msg->new_uri.s || parse_uri( msg->new_uri.s,msg->new_uri.len,&uri)<0
520 || !uri.user.len )
521 {
522 LM_DBG("trying to get user from R_uri\n");
523 if ( parse_uri( msg->first_line.u.request.uri.s,
524 msg->first_line.u.request.uri.len ,&uri)==-1 || !uri.user.len )
525 {
526 LM_DBG("trying to get user from To\n");
527 if ( (!msg->to&&((parse_headers(msg,HDR_TO_F,0)==-1)||!msg->to))||
528 parse_uri( get_to(msg)->uri.s, get_to(msg)->uri.len, &uri)<0
529 || !uri.user.len)
530 {
531 LM_ERR("unable to extract user name from RURI or To header!\n");
532 return -1;
533 }
534 }
535 }
536 *username = uri.user;
537 *domain = uri.host;
538 return 0;
539}
540
541
542

Callers 3

cpl_invoke_scriptFunction · 0.85
do_script_actionFunction · 0.85
do_script_downloadFunction · 0.85

Calls 1

parse_uriFunction · 0.85

Tested by

no test coverage detected