From 01304ca4369de2e4c6a843ea692c69611d559f47 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Date: Wed, 15 Sep 2010 11:54:07 -0400
Subject: [PATCH] [#4066] Parse "allowed" header from requests

---
 sflphone-common/src/sip/sipvoiplink.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp
index e111516f82..2943cb67a2 100644
--- a/sflphone-common/src/sip/sipvoiplink.cpp
+++ b/sflphone-common/src/sip/sipvoiplink.cpp
@@ -3118,6 +3118,23 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
         return;
     }
 
+    pjsip_hdr *allow_header = NULL;
+    std::string *allowed_options = NULL;
+
+    char header_buffer[500];
+
+    if (e->body.tsx_state.src.rdata->msg_info.msg)
+        allow_header = (pjsip_hdr *) pjsip_msg_find_hdr (e->body.tsx_state.src.rdata->msg_info.msg, PJSIP_H_ALLOW, NULL);
+
+    if (allow_header) {
+        allowed_options = new std::string (allow_header->name.ptr, allow_header->name.slen);
+        allow_header->vptr->print_on (allow_header, header_buffer, 5000);
+        std::string theHeader (header_buffer);
+    }
+
+    if (allowed_options)
+        delete allowed_options;
+
     // If this is an outgoing INVITE that was created because of
     // REFER/transfer, send NOTIFY to transferer.
     if (call->getXferSub() && e->type==PJSIP_EVENT_TSX_STATE) {
-- 
GitLab