Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append HF don't work in event_route #3006

Closed
Eulnono76 opened this issue Jan 24, 2022 · 5 comments
Closed

Append HF don't work in event_route #3006

Eulnono76 opened this issue Jan 24, 2022 · 5 comments

Comments

@Eulnono76
Copy link

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@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@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

@henningw
Copy link
Contributor

The bug tracker is for tracking of bugs in Kamailio, not for discussing user related questions. Please contact our sr-users list instead.
The append_hf can be used in event_route. If you want to see it in logs, you could use the textops msg_apply_changes() function.

@Eulnono76
Copy link
Author

Didn't try to see it in log, I see the complete frame with $mb and I see my append is missing.
Also when I try msg_apply_changes(), getting unknown command, missing loadmodule, textops is correctly loaded (loadmodule "textops.so").
Are you really sure there is no issue ?

@henningw
Copy link
Contributor

@Eulnono76
Copy link
Author

when I try msg_apply_changes(), getting unknown command, missing loadmodule, textops is correctly loaded (loadmodule "textops.so").

@henningw
Copy link
Contributor

Please read the quoted link, its textopsx module. For more question please consult the mailing list.

@kamailio kamailio locked as off-topic and limited conversation to collaborators Jan 24, 2022
@kamailio kamailio unlocked this conversation Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants