Is there a way to get the current status of a siptrunk?
Whether it is reachable or unreachable based on the response to OPTIONS requests.
I am using AMI, and I do get the event PeerStatus with the information, but only when it is changing.
Is there a way to request this information upon start up? Either by AMI or CLI?
Asterisk has no concept of a SIP trunk. You can get the qualify status, for a SIP endpoint, using the DEVICE_STATE function. Functions can be accessed from AMI, as though they were variables.
Note that this doesn’t force OPTIONS to be sent, so you will need to wait until that has happened, to get a valid result. There may be a command to force a single OPTIONS challenge.
I am well aware of how to enable OPTION request and what they are used for - and yes you can request an OPTIONS request to be sent, but this does not reveal the reachability of the endpoint.
The DEVICESTATE function can return these values:
UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING |
RINGINUSE | ONHOLD
These are not what I am looking for. I am looking for getting the reachable/unreachable status for the AORs for which I have set the qualify_frequency to ex. 60.
I get an event when the PeerStatus changes like the one below - in this case letting me know that Asterisk has sent an OPTIONS request and received a response.
Event: PeerStatus
Privilege: system,all
SystemName: novusweu1
ChannelType: PJSIP
Peer: PJSIP/15_zylincdev15
PeerStatus: Reachable
If no response is received then the PeerStatus changes to Unreachable, and any attempt to dial via this endpoint will be rejected until the endpoint becomes Reachable again or if I disable the OPTIONS qualify
What I am looking for is how to request the current PeerStatus upon start up.
Is this possible?
Using either AMI, CLI, Dialplan Applications, Dialplan Functions, AGI - or in any other way you can think of.
Before PjSip I could get the information using the manager action: SIPpeerstatus, but I can’t find any PjSip version of this.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.