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

Function enum_query

modules/enum/enum.c:649–686  ·  view source on GitHub ↗

* See documentation in README file. */

Source from the content-addressed store, hash-verified

647 * See documentation in README file.
648 */
649int enum_query(struct sip_msg* _msg, str* _suffix, str* _service, str* _num)
650{
651 char *user_s;
652 int user_len, i, j;
653 char name[MAX_DOMAIN_SIZE];
654 char string[17];
655
656 if (!_num) {
657 if (parse_sip_msg_uri(_msg) < 0) {
658 LM_ERR("Parsing of R-URI failed\n");
659 return -1;
660 }
661
662 _num = &_msg->parsed_uri.user;
663 }
664
665 if (is_e164(_num) == -1) {
666 LM_ERR("number is not in E164 format\n");
667 return -1;
668 }
669
670 user_s = _num->s;
671 user_len = _num->len;
672
673 memcpy(&(string[0]), user_s, user_len);
674 string[user_len] = (char)0;
675
676 j = 0;
677 for (i = user_len - 1; i > 0; i--) {
678 name[j] = user_s[i];
679 name[j + 1] = '.';
680 j = j + 2;
681 }
682
683 memcpy(name + j, _suffix->s, _suffix->len + 1);
684
685 return do_query(_msg, string, name, _service);
686}
687
688
689/*

Callers

nothing calls this directly

Calls 2

parse_sip_msg_uriFunction · 0.85
do_queryFunction · 0.85

Tested by

no test coverage detected