Function SIPPEER

In my dialplan I try to determine the status of an upstream provider.

same => n,Verbose(${SIPPEER(Outbound-Provider,status)})

But I get an error … do I have to load an additional module?

ERROR[885764][C-0000002d]: pbx_functions.c:608 ast_func_read: Function SIPPEER not registered

That only works if you are using chan_sip. Are you using chan_sip?

Are you still using the deprecated chan_sip driver?

You may want PJSIP_CONTACT, although most people would be satisfied with DEVIE_STATE.

I am using PJSIP.

PJSIP_CONTACT would be the equivalent in PJSIP?

PJSIP_CONTACT only works for type=contact

The type I want to check is type=endpoint.

That’s the only one that provides that information precisely, but as I said, DEVICE_STATE is what people would normally use when they wanted that information.

The documentation for PJSIP_CONTACT seems defective, in that it doesn’t tell you how to construct a contact name.

same => n,Verbose(${DEVICE_STATE(SIP/Outbound-Provider)})

returns INVALID, although that provider is working …

I’m not sure I am using the function correctly, the wiki isn’t really clear about that.

You are using PJSIP so the technology can’t be SIP/

Ok SIP would refer to the old technoloy chan_sip I guess?

I replaced SIP with PJSIP in the argument string and now it is working.

Thank you, sorry the documentation is little bit irritating sometimes.

My goal is to detect a provider is offline or not reachable over the network.
DEVICE_STATE returns NOT_INUSE if I configure a wrong IP address (just for testing purpose).
Shouldn’t it return UNAVAILABLE or UNKNOWN in that case?
Or is it the wrong function for my use case?

Are you sure you are not getting a well formed response?

Is qualify turned on?

Did you allow it enough time to determine that it wasn’t responding?

Try the various pjsip cli commands to find the qualify status.

I had to set the qualify fields in my AOR objects. Now it works, thank you!

qualify_frequency=5
qualify_timeout=3.0

The documentation isn’t clear about the time units of qualify_frequency. I guess it’s seconds (could be ms …)? Millisecond ping would be weird :wink:

1 Like