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

Function ospGetOperatorName

modules/osp/sipheader.c:1709–1815  ·  view source on GitHub ↗

* Get operator name from Request-Line * param msg SIP message * param type Operator name type * param name Operator name buffer * param namebufsize Size of name buffer * return 0 success, 1 not use NP or without operator name, -1 failure */

Source from the content-addressed store, hash-verified

1707 * return 0 success, 1 not use NP or without operator name, -1 failure
1708 */
1709int ospGetOperatorName(
1710 struct sip_msg* msg,
1711 OSPE_OPERATOR_NAME type,
1712 char* name,
1713 int namebufsize)
1714{
1715 str sv;
1716 param_hooks_t phooks;
1717 param_t* params = NULL;
1718 param_t* pit;
1719 int result = -1;
1720
1721 if (((name != NULL) && (namebufsize > 0))) {
1722 name[0] = '\0';
1723
1724 if (_osp_use_np != 0) {
1725 if (parse_sip_msg_uri(msg) >= 0) {
1726 switch (msg->parsed_uri.type) {
1727 case TEL_URI_T:
1728 case TELS_URI_T:
1729 sv = msg->parsed_uri.params;
1730 break;
1731 case ERROR_URI_T:
1732 case SIP_URI_T:
1733 case SIPS_URI_T:
1734 default:
1735 sv = msg->parsed_uri.user;
1736 break;
1737 }
1738 if (parse_params(&sv, CLASS_ANY, &phooks, &params) == 0) {
1739 for (pit = params; pit; pit = pit->next) {
1740 switch (type) {
1741 case OSPC_OPNAME_SPID:
1742 if ((pit->name.len == OSP_SPID_SIZE) &&
1743 (strncasecmp(pit->name.s, OSP_SPID_NAME, OSP_SPID_SIZE) == 0) &&
1744 (name[0] == '\0'))
1745 {
1746 ospCopyStrToBuffer(&pit->body, name, namebufsize);
1747 }
1748 break;
1749 case OSPC_OPNAME_OCN:
1750 if ((pit->name.len == OSP_OCN_SIZE) &&
1751 (strncasecmp(pit->name.s, OSP_OCN_NAME, OSP_OCN_SIZE) == 0) &&
1752 (name[0] == '\0'))
1753 {
1754 ospCopyStrToBuffer(&pit->body, name, namebufsize);
1755 }
1756 break;
1757 case OSPC_OPNAME_SPN:
1758 if ((pit->name.len == OSP_SPN_SIZE) &&
1759 (strncasecmp(pit->name.s, OSP_SPN_NAME, OSP_SPN_SIZE) == 0) &&
1760 (name[0] == '\0'))
1761 {
1762 ospCopyStrToBuffer(&pit->body, name, namebufsize);
1763 }
1764 break;
1765 case OSPC_OPNAME_ALTSPN:
1766 if ((pit->name.len == OSP_ALTSPN_SIZE) &&

Callers 1

ospRequestRoutingFunction · 0.85

Calls 4

parse_sip_msg_uriFunction · 0.85
parse_paramsFunction · 0.85
ospCopyStrToBufferFunction · 0.85
free_paramsFunction · 0.85

Tested by

no test coverage detected