Spoofing NOTIFY Message

Status
Not open for further replies.

pksml

New Member
Dec 20, 2022
9
2
3
45
Hello fellow FusionPBX-ers. I am near to pulling my hair out on this one...

I have Yealink T46S phones. It's a commonly-reported problem that when you go in to DND mode, the line key LED will not switch to red on everyone else's phones for your extension.

So I thought I could spoof the NOTIFY message that occurs when a call comes in.

For instance, here is a NOTIFY message that tells one of the phones that a call has been answered on extension 120. If I could spoof a message like this, I could tell the other extensions that extension 120 is in DND with the LED turning red.

Code:
NOTIFY sip:120@192.168.2.102:12569;transport=TCP SIP/2.0
Via: SIP/2.0/TCP 192.168.2.2;branch=z9hG4bKU0aS9K06a1BtS
Max-Forwards: 70
From: <sip:110@myvoipserver.com:5060>;tag=eOGt63qVuTTR
To: "120 - Cat" <sip:120@myvoipserver.com:5060>;tag=1943431340
Call-ID: 0_1943505683@192.168.2.102
CSeq: 1532010201 NOTIFY
Contact: <sip:110@192.168.2.2:5060;transport=tcp>
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: path, replaces
Event: dialog
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Subscription-State: active;expires=1317
Content-Type: application/dialog-info+xml
Content-Length: 586

<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="83" state="full" entity="sip:110@myvoipserver.com">
<dialog id="a1aa3942-d078-42af-91be-d52a0fbe6bbf" direction="recipient">
<state>confirmed</state>
<local>
<identity display="110">sip:110@myvoipserver.com</identity>
<target uri="sip:110@myvoipserver.com">
<param pname="+sip.rendering" pvalue="yes"/>
</target>
</local>
<remote>
<identity display="SARA ROGERS">sip:4134044133@myvoipserver.com</identity>
<target uri="sip:**110@myvoipserver.com"/>
</remote>
</dialog>
</dialog-info>

Would I need to use the ESL to do this? Any other ideas to solve this dilemma? Thanks in advance and Merry Christmas and Happy New Year to you!
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,527
443
83
Yes, you can do it. It isn't really spoofing a NOTIFY, you are just asking FreeSWITCH to send out a NOTIFY message. Generally you would use ESL for this but it can also be done via mod_amqp using the TAP.Command exchange.

If you go down this route, please be aware that the phone will automatically revert the line key back to green after a period of time, so you will probably need to run a background process to keep refreshing it to be red. There may be a better or more conventional way of doing what you want, but it is not something I have ever investigated.

FusionPBX does this for busy lamps that are used for call flows such as night service. it is a .lua script that is run at startup, you can find the script here:
https://github.com/fusionpbx/fusion...witch/resources/scripts/call_flow_monitor.lua

DjangoPBX has two options, a background process that runs continuously or a script that can be fired ad-hoc or from a regular cron job. Links to both below:
https://codeberg.org/DjangoPBX/DjangoPBX/src/branch/main/pbx/scripts/call_flow_monitor_daemon.py
https://codeberg.org/DjangoPBX/DjangoPBX/src/branch/main/pbx/scripts/call_flow_monitor.py

The latter will be the easiest to understand at a quick glance.

You should be able to adapt any of the above to meet you needs.
 

pksml

New Member
Dec 20, 2022
9
2
3
45
Thanks for all that detailed information Adrian! I really appreciate it! It feels like I'm getting closer to my goal.

I've done some researching and isolated the PRESENCE_IN events from a call using telnet and tee. There are approximately 70-110 parameters with these events... I wonder which ones are the important ones and which parameters I need to make up values for...

I'm thinking ESL is the way to go, though it's too bad the official PHP implementation isn't compatible anymore. Guess I'll have to go the more raw route and use a basic script. I don't know anything about mod_amqp or a rabbit server. What is that even for/what does it do? (The Freeswitch docs don't say much...)

And I was figuring that the phones wouldn't keep blinking forever :). So I'll just have to cron my script.

Just within the past week, I saw your article about the end of year DjangoPBX post. I'll send you a message about it. Maybe I can give it a test drive when I have the time!
 
Status
Not open for further replies.