Module: kamailio Branch: master Commit: 70fd27174952fe6a67f01fca4fdc941b9fdc045a URL: https://github.com/kamailio/kamailio/commit/70fd27174952fe6a67f01fca4fdc941b9fdc045a
Author: Dragos Vingarzan <vingar...@gmail.com> Committer: Dragos Vingarzan <vingar...@gmail.com> Date: 2024-07-12T13:27:21+02:00 lib/ims: added cscf_get_host_from_requri --- Modified: src/lib/ims/ims_getters.c Modified: src/lib/ims/ims_getters.h --- Diff: https://github.com/kamailio/kamailio/commit/70fd27174952fe6a67f01fca4fdc941b9fdc045a.diff Patch: https://github.com/kamailio/kamailio/commit/70fd27174952fe6a67f01fca4fdc941b9fdc045a.patch --- diff --git a/src/lib/ims/ims_getters.c b/src/lib/ims/ims_getters.c index cf2f618d0de..35dbdca405f 100644 --- a/src/lib/ims/ims_getters.c +++ b/src/lib/ims/ims_getters.c @@ -539,6 +539,21 @@ str cscf_get_contact_from_requri(struct sip_msg *msg) return pu; } +/** + * Get the host from the Request URI of the message. + * Useful for example on MT, to get the destination from the Request URI, if P-Called-Party-ID is not present. + */ +str cscf_get_host_from_requri(struct sip_msg *msg) +{ + if(msg->first_line.type != SIP_REQUEST || parse_sip_msg_uri(msg) < 0 + || msg->parsed_uri.type == TEL_URI_T) { + str empty = {0}; + return empty; + } + return msg->parsed_uri.host; +} + + /** * Finds if the message contains the orig parameter in the first Route header * @param msg - the SIP message diff --git a/src/lib/ims/ims_getters.h b/src/lib/ims/ims_getters.h index 77a55a6695b..03ad4bef82b 100644 --- a/src/lib/ims/ims_getters.h +++ b/src/lib/ims/ims_getters.h @@ -206,6 +206,12 @@ str cscf_get_public_identity_from_requri(struct sip_msg *msg); */ str cscf_get_contact_from_requri(struct sip_msg *msg); +/** + * Get the host from the Request URI of the message. + * Useful for example on MT, to get the destination from the Request URI, if P-Called-Party-ID is not present. + */ +str cscf_get_host_from_requri(struct sip_msg *msg); + /** * Looks for the Call-ID header * @param msg - the sip message _______________________________________________ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org