[sr-dev] [kamailio/kamailio] Append HF don't work in event_route (Issue #3006)

Eulnono76 notifications at github.com
Mon Jan 24 10:58:47 CET 2022


### Description

Hello,

I'm trying to connect kamailio to Microsoft Teams.
Dispatch is correctly configured and send SIP OPTION correctly.
Following this tutorial : https://skalatan.de/en/blog/kamailio-sbc-teams, I added an Event_Route to add contact header to SIP OPTION from dispath to MS :

event_route[tm:local-request] {
   xlog("*** tm:local-request *** ");
        if(is_method("OPTIONS") && $ru =~ "pstnhub.microsoft.com") {
               xlog("L_INFO", "Append new contact !\n");
               append_hf("Contact: <sip:MY_SBC_NAME.COM:5061;transport=tls>\r\n");
        }
        xlog("L_INFO", "Sent out tm request: $mb\n");
}

When I check the log to see my sended frame, I don't see a contact header field :
_INFO: <script>: Append new contact !
INFO: <script>: Sent out tm request :
OPTIONS sip:sip.pstnhub.microsoft.com;transport=tls SIP/2.0
Via: SIP/2.0/TLS MY_SBC_NAME.COM:5061;branch=z9hG4bK4497.f3e5e754000000000000000000000000.0
To: <sip:sip.pstnhub.microsoft.com;transport=tls>
From: <sip:MY_SBC_NAME.COM.fr>;tag=a76e006ace3802951ed860e08df964af-7971
CSeq: 10 OPTIONS
Call-ID: 2e1278ea77796160-9837 at MY_SBC_IP
Max-Forwards: 70
Content-Length: 0
User-Agent: kamailio (5.2.1 (x86_64/linux))_

According the documentation about textop, append_hf(txt[, hdr]) :
_This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE._

So my question is append HF can be used in Event_route ?
Is there any other way to add contact header ?

Regards,
Arnaud

### Troubleshooting

#### Reproduction

Can be easily reproducted with the following code (don t forget to set SBC NAME)

event_route[tm:local-request] {
   xlog("*** tm:local-request *** ");
        if(is_method("OPTIONS") && $ru =~ "pstnhub.microsoft.com") {
               xlog("L_INFO", "Append new contact !\n");
               append_hf("Contact: <sip:MY_SBC_NAME.COM:5061;transport=tls>\r\n");
        }
        xlog("L_INFO", "Sent out tm request: $mb\n");
}



#### Log Messages

INFO: <script>: Append new contact !
INFO: <script>: Sent out tm request :
OPTIONS sip:sip.pstnhub.microsoft.com;transport=tls SIP/2.0
Via: SIP/2.0/TLS MY_SBC_NAME.COM:5061;branch=z9hG4bK4497.f3e5e754000000000000000000000000.0
To: <sip:sip.pstnhub.microsoft.com;transport=tls>
From: <sip:MY_SBC_NAME.COM.fr>;tag=a76e006ace3802951ed860e08df964af-7971
CSeq: 10 OPTIONS
Call-ID: 2e1278ea77796160-9837 at MY_SBC_IP
Max-Forwards: 70
Content-Length: 0
User-Agent: kamailio (5.2.1 (x86_64/linux))
```

#### SIP Traffic

Traffic is in TLS, can't be easily readed.

### Additional Information

version: kamailio 5.3.9 (x86_64/linux) a5fd0a
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: a5fd0a
compiled on 15:59:30 Jan 10 2022 with gcc 8.3.0

* **Operating System**:

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

Linux debian 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux



-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3006
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/3006 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220124/b97d588b/attachment.htm>


More information about the sr-dev mailing list