Error: Gateway information missing Subscription Event: message-summary

Hi.

Summary:

I’m using FreeSwitch as a SIP client registering to an external PBX. Calls
inbound and outbound are working fine. I can’t get MWI working.

I can get presence information from the external PBX by adding the following
to my <gateway> definition:

<subscriptions name=“Presence”>
<subscription event=“presence”>
<param name=“retry-seconds” value=“30”/>
<param name=“expire-seconds” value=“120”/>
<param name=“username-in-request” value=“true”/>
</subscription>
</subscriptions>

I’ve added an event hook to my lua configuration:

<hook event=“ALL” script=“Events.lua”/>

(It’s seeing ALL events for now, for debugging purposes.)

This is also working fine - it calls my Events.lua script with a NOTIFY_IN
event for presence and the script does what I want.

The bit which I cannot get working is Message Waiting Indication.

I can see using sngrep that NOTIFYs are coming in to FreeSwitch from my PBX,
but FreeSwitch shows in its console:

sofia.c:743 Gateway information missing Subscription Event: message-summary

After trying to parse this for a while I’ve come to the conclusion that it is
telling me that “Gateway information is missing from a subscription event
named message-summary”, however I have been unable to find out what I need to
do about this.

I’ve tried adding a <subscription> section to my gateway with an event name of
“message-summary” and this does output the encouraging message:

sofia_reg.c:263 subscribing to [message-summary] on gateway [00280000000021]

however it makes no difference to the “Gateway information missing Subscription
Event: message-summary” messages.

The NOTIFYs which come from my PBX for presence and for message-summary seem
sufficiently similar to each other, so I can’t see what’s missing from the
latter which FreeSwitch is looking for. sngrep shows me the following:

Note: 172.16.183.36 is my FreeSwitch client
172.31.77.56 is the remote PBX sending the NOTIFYs
00280000000021 is the name of the FreeSwitch gateway registered to the PBX

NOTIFY sip:gw+00280000000021@172.16.183.36:50060;gw=00280000000021 SIP/2.0
Via: SIP/2.0/UDP 172.31.77.56:5060;rport;branch=z9hG4bKPj23f12d98-
f765-4020-920d-40bc3de577a3
From: <sip:941@external.PBX.example.com>;tag=3c568a23-3152-491d-97db-
d0bd9cdc470e
To: <sip:941@external.PBX.example.com>;tag=80UNFmHDND7gS
Contact: <sip:172.31.77.56:5060>
Call-ID: 430242d1-a0c9-123c-faab-feff0000a1cc
CSeq: 17034 NOTIFY
Event: presence
Subscription-State: terminated
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk
Content-Type: application/pidf+xml
Content-Length: 406

(XML presence information snipped.)

NOTIFY sip:gw+00280000000021@172.16.183.36:50060;gw=00280000000021 SIP/2.0
Via: SIP/2.0/UDP 172.31.77.56:5060;rport;branch=z9hG4bKPj36f98757-
f2ba-4df2-9811-771cfcf3240d
From: <sip:941@172.31.77.56>;tag=fe6913e4-2332-4614-9488-5db184c40239
To: <sip:gw+00280000000021@172.16.183.36;gw=00280000000021>
Contact: <sip:941@172.31.77.56:5060>
Call-ID: cd187591-502c-4d9e-9eb8-2b3c44b356ab
CSeq: 25630 NOTIFY
Subscription-State: terminated
Event: message-summary
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk
Content-Type: application/simple-message-summary
Content-Length: 49

Messages-Waiting: yes
Voice-Message: 4/0 (0/0)

Note that in BOTH cases, FreeSwitch is responding back with a 200 OK.

Can anyone help me get FreeSwitch responding to MWI when it’s a client to an
external PBX?

Thanks,

Antony.

Look at the c code and see why it prints that, its on sofia.c:743

/b

Yes; I have done that; the reason appears to be:

if (!sofia_private || zstr(sofia_private->gateway_name))

from which I am guessing that sofia_private does not contain a gateway_name

How do I either get one in there, or find out why not?

The NOTIFY does contain the gateway name in the SIP message.

Antony.

Show us the gateway config XML

/b

<gateway name=“00280000000021”>
<param name=“username” value=“941”/>
<param name=“password” value=“p455w0rd”/>
<param name=“proxy” value=“external.PBX.example.com”/>
<param name=“register” value=“true”/>
<param name=“context” value=“PBXtoPiPxt”/>

  <subscriptions name="Presence">
    <subscription event="presence">
      <param name="retry-seconds" value="15"/>
      <param name="expire-seconds" value="20"/>
      <param name="username-in-request" value="true"/>
    </subscription>

  </subscriptions>
</gateway>

Antony.

How can I take this further?

How can I find out what I’m missing in my configuration, or what is wrong with
the NOTIFY being sent by the remote PBX, so that I can correct it and get the
events accepted and handled by FreeSwitch?

Surely I can’t be the first person to want to have FreeSwitch receive MWI
events from a remote PBX? How have others configured it?

Antony.

I’ve turned on “sofia profile X siptrace on” which now shows me the SIP packets
received and sent, interspersed with the debug messages from processing those
packets.

Here is a NOTIFY telling me about presence (replied from FreeSwitch with OK
and processed correctly):

recv 1019 bytes from udp/[172.31.77.56]:5060 at 13:09:55.619720:

NOTIFY sip:gw+00280000000021@172.16.183.38:50060;gw=00280000000021 SIP/2.0
Via: SIP/2.0/UDP 172.31.77.56:5060;rport;branch=z9hG4bKPj8fd88473-2617-4807-
a647-b14624e5d637
From: sip:941@external.PBX.example.com;tag=7baa4d4d-3723-4f65-
a82f-8ca2b251e929
To: sip:941@external.PBX.example.com;tag=tmXm68U2mU2cF
Contact: sip:172.31.77.56:5060
Call-ID: 2e371b9d-a199-123c-88ba-feff0000a1cb
CSeq: 24729 NOTIFY
Event: presence
Subscription-State: active;expires=3600
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk
Content-Type: application/pidf+xml
Content-Length: 406

<?xml version=“1.0” encoding=“UTF-8”?>
<presence entity=“sip:941@172.31.77.56:5060”
xmlns=“urn:ietf:params:xml:ns:pidf”
xmlns:dm=“urn:ietf:params:xml:ns:pidf:data-model”
xmlns:rpid=“urn:ietf:params:xml:ns:pidf:rpid”>
Ready


open

sip:941@external.PBX.example.com

<dm:person />
</presence>

send 578 bytes to udp/[172.31.77.56]:5060 at 13:09:55.619817:

SIP/2.0 200 OK
Via: SIP/2.0/UDP
172.31.77.56:5060;rport=5060;branch=z9hG4bKPj8fd88473-2617-4807-a647-
b14624e5d637
From: sip:941@external.PBX.example.com;tag=7baa4d4d-3723-4f65-
a82f-8ca2b251e929
To: sip:941@external.PBX.example.com;tag=tmXm68U2mU2cF
Call-ID: 2e371b9d-a199-123c-88ba-feff0000a1cb
CSeq: 24729 NOTIFY
Contact: sip:gw+mwi941@172.16.183.38:50060;transport=udp;gw=mwi941
User-Agent: FS Dev 1.8 helen
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER,
REFER, NOTIFY
Supported: timer, path, replaces
Content-Length: 0

Here is the log output from my lua script which is handling all events seen:

2023-07-20 13:09:55.608576 69.83% [INFO] switch_cpp.cpp:1465 Events.lua: noID
(78e6eea8-a74d-4203-9993-09e3e755f8e4) handling a NOTIFY_IN event at
2023-07-20 13:09:55

I have no idea why the following message appears:

2023-07-20 13:09:55.608576 69.83% [DEBUG] sofia.c:816 dispatched freeswitch
event for message-summary NOTIFY

Now here is another NOTIFY from the same source and for the same registered
gateway, but instead of being about presence, this one is message-summary.
Again, FreeSwitch responds to it with an OK, but does not process it
correctly:

recv 682 bytes from udp/[172.31.77.56]:5060 at 13:10:03.868283:

NOTIFY sip:gw+00280000000021@172.16.183.38:50060;gw=00280000000021 SIP/2.0
Via: SIP/2.0/UDP 172.31.77.56:5060;rport;branch=z9hG4bKPj3387d2f1-f26e-4e19-
ae1a-21fc220050ce
From: sip:941@172.31.77.56;tag=900d80fc-6a78-464b-9586-48bc79f817b5
To: sip:gw+00280000000021@172.16.183.38;gw=00280000000021
Contact: sip:941@172.31.77.56:5060
Call-ID: d2c4fd6e-1430-4091-ab3e-fe1180b2a130
CSeq: 42393 NOTIFY
Subscription-State: terminated
Event: message-summary
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk
Content-Type: application/simple-message-summary
Content-Length: 49

Messages-Waiting: yes
Voice-Message: 4/0 (0/0)

2023-07-20 13:10:03.868562 66.53% [DEBUG] sofia.c:743 Gateway information
missing Subscription Event: message-summary

send 645 bytes to udp/[172.31.77.56]:5060 at 13:10:03.868798:

SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.31.77.56:5060;rport=5060;branch=z9hG4bKPj3387d2f1-
f26e-4e19-ae1a-21fc220050ce
From: sip:941@172.31.77.56;tag=900d80fc-6a78-464b-9586-48bc79f817b5
To: sip:gw+00280000000021@172.16.183.38;gw=00280000000021;tag=UXpD83c6H4rZa
Call-ID: d2c4fd6e-1430-4091-ab3e-fe1180b2a130
CSeq: 42393 NOTIFY
Contact:
sip:gw+00280000000004@172.16.183.38:50060;transport=udp;gw=00280000000004
User-Agent: FS Dev 1.8 helen
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER,
REFER, NOTIFY
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, refer
Content-Length: 0

So, what is the problem with the second one which causes the error message
“Gateway information missing”?

The gateway name is 00280000000021

Thanks in advance,

Antony.

What exactly are you expecting here?

I’m expecting to get a NOTIFY_IN event when a message_summary NOTIFY is
received from the remote PBX.

Or, to put it another way, I’m expecting FreeSwitch to respond to an MWI
notification when it registers as a client to a SIP server.

Antony.

Ugh.

I just realised that the forum software has swallowed the majority of what I posted there.

I’ll see if I can edit it or re-post it with the detail I wanted people to see.

Antony.

Update: I’ve managed to edit the previous posting and add the SIP debug data (although it still isn’t a verbatim copy of what I pasted into the editor) - hopefully that explains things a bit better.

If someone can tell me how to put text into this forum and get it to be shown as I typed it, instead of varying amounts amended, deleted or reformatted, that would also probably be helpful.
I’m struggling enough with the software; I didn’t expect to have to do the same with the support system.

Sorry if I sound a bit crotchety about this but it’s irritating when I try to supply plenty of detail for people to understand what I’m doing and what then happens, only to find out that 90% of the posting has disappeared (and I don’t get a copy sent back by email to show me that).

Just pasting simple XML here (which is a pretty basic thing where FreeSwitch is concerned) doesn’t work without some creative manual fiddling, such as prefixing every < with \ (and I just had to edit that backslash to make it appear, too)

FreeSWITCH as a client in this way would require you to do some work with ESL to do anything with the message-summary, if I recall FreeSWITCH will just 200OK it and do nothing at all with it. If you want to do something with it subscribe to the event, tie it to something that can so something with it.

/b

FreeSWITCH as a client in this way would require you to do some work with
ESL to do anything with the message-summary, if I recall FreeSWITCH will
just 200OK it and do nothing at all with it.

I confirm that FS does send a 200 OK.

If you want to do something with it subscribe to the event, tie it to
something that can do something with it.

I have connected to the Event Socket (trivially, using telnet for now) in
order to investigate whether this helps, but I see the “presence” NOTIFY
commands come through, but still not “message-summary” events.

So, I’m not convinced that MWI is even reaching ESL.

Antony.

It might not be firing an event, you’d need to review in sofia_reg.c to see if it does.

/b