I need this to monitor the device - on chan_sip - if it was Unspecified - I knew the device was offline. If the IP is reported - then also I can reflect that on my forms.
I just ran “pjsip list contacts” and it said No objects found.
Jerry
I need this to monitor the device - on chan_sip - if it was Unspecified - I knew the device was offline. If the IP is reported - then also I can reflect that on my forms.
I just ran “pjsip list contacts” and it said No objects found.
Jerry
In that case, you use the state field on the first line, or on the contact line, if there is one contact, or you want to distinguish between contacts.
I suspect you can also define hints, and use core show hints. If that works, it will be channel driver independent.
I would “rather” not request multiple AMI or multiple CLI to get data. like the IP.
I was hoping PJSIP would be “better” “newer” and more flexible.
How can I get the IP added (perhaps through an option) that would include that in the output of showing/listing the endpoints ? its seems logical.
Jerry
Your given use case doesn’t require the IP.
Generally, if you want to use device states to affect call flow, you access the device state directly, from the dialplan. If you want it for a busy lamp field, you use hints. If you want it to keep track of the system state, for external purposes, you use AMI Events, which should be a lot less costly than polling with a CLI command.
None of these are technology dependent,and they work even for non-IP based lines (at least in principle - I don’t know if DAHDI alarm states are reflected).
It seems to be that you are confusing goals and the way you are achieving them. You have a way of achieving the goal which is based on IP addresses existing.
Incidentally, the IP address tactic only tells you that the device registered, the last time it was due to register. It doesn’t tell you if it is currently reachable. With qualify enabled, SIP type device states will tell you about devices that are unreachable.
“Your given use case doesn’t require the IP” - Actually it does.
The CUSTOMER wants to see the IP - almost every customer looks at the status page to see the IP.
Another use case - I have LED signs that are SIP based that I use - the Sign boots and and connects to the server - I then have to “dump” the IP’s of the extension for the SIP part so that I can “read” the IP and connect to the LED signs and post to it a URL that controls the content of the sign.
so in fact “yes” I really need the IP.
How can I get it - AMI does not report it, list endpoints does not have it - chan_sip had it - I ‘need’ it.
Thanks
Jerry
Most people using Asterisk would be using DHCP and would have no idea which IP address applies to which phone.
The reason your requirement is difficult to support is that it is a very unusual requirement.
The device has 3 functions - flashing lights controlled by http post, SIP endpoint for audio and LED sign to scroll messages. It worked great under chan_sip
How can printing the IP be include in PJSIP ??? again an option is fine to list it , a new command is fine - anything is fine - I just need it.
Jerry
By modifying the code? By convincing someone to modify/change/add things to meet your own needs? I’m not sure what kind of answer/response you’re really expecting.
Note that any implementation that only ever returns one IP address will be dealing with a special case. That might be your case, but it is not the general case. The ability to only handle one IP per peer was a significant limitation of chan_sip, e.g resulting in the inbound and outbound channel hacks, which ended up being used even when they weren’t needed.
Well then - let me just change and pose the question.
I had functionality in chan_sip that I could successfully get the current IP address of the registered device. I am trying to migrate to chan_pjsip and use that same function.
how can I accomplish this? I “have” to have the IP address so that I can “post” a URL back to the device.
Thank you.
Jerry
Use the AMI action to get the registered inbound contacts[1]. Discard any events that don’t match the endpoint name. Parse the URI to get the IP address.
[1] PJSIPShowRegistrationInboundContactStatuses - Asterisk Documentation
Posting back sounds like you are doing this whilst a call is in progress. For that you want information for the channel, not the device. (CHANNEL(remote_addr))
I feel I’m being drip fed with information, which isn’t even consistent from one drip to the next.
With chan_sip you have repurposed an interface intended for human debuggers for operational use.
Hi - Sorry if you feel there is something I am not sharing. Surely not intentional.
I’m simply saying and showed examples above - chan_sip gave me the EXT and IP.
I simply desire the same thing from PJSIP.
I ran the suggested command above just now.
Response: Success
EventList: start
Message: Following are ContactStatusEvents for each Inbound registration
Event: ContactStatusDetailComplete
EventList: Complete
ListItems: 0
Nothing was reported back. I have 9 devices defined at this time.
Endpoint: <Endpoint/CID…> <State…> <Channels.>
==========================================================================================
Endpoint: 501 Unavailable 0 of inf
Endpoint: 502 Unavailable 0 of inf
Endpoint: 503 Unavailable 0 of inf
Endpoint: 504 Unavailable 0 of inf
Endpoint: VMImage_to_MC001 Unavailable 0 of inf
Endpoint: VMImage_to_MC002 Unavailable 0 of inf
Endpoint: VMImage_to_MC003 Unavailable 0 of inf
Endpoint: VMImage_to_MC004 Unavailable 0 of inf
Endpoint: production_to_testing Unavailable 0 of inf
Objects found: 9
I dont see the “desired” output of a listing of extensions and IP addresses for that device.
Thanks
Jerry
None of them have registered. Asterisk has not been told their addresses. Are they still registering to chan_sip?
There should be 1 that is registered. the production one.
The production on is running chan_sip - and shows the correct address to the PJSIP machine.
Looking further, error on PJSIP side
[May 29 08:45:47] ERROR[987678] res_pjsip_config_wizard.c: Wizard ‘production_to_testing’ must have ‘remote_hosts’ if it doesn’t accept registrations.
[May 29 08:45:47] ERROR[987678] res_pjsip_config_wizard.c: Unable to create objects for wizard ‘production_to_testing’
I want PJSIP to accept registrations.
[production_to_testing]
type=wizard
inbound_auth/username=test_to_prodction
inbound_auth/password=secret
description=Test asterisk 20 PJSIP
disallow=all
allow=ulaw
allow=alaw
allow=gsm
context=testing
I must have missed something?
Jerry
[test_to_production]
type=wizard
accepts_registrations = yes
sends_registrations = no
accepts_auth = yes
sends_auth = no
inbound_auth/username=test_to_prodction
inbound_auth/password=secret
endpoint/disallow=all
endpoint/allow=ulaw
endpoint/allow=alaw
endpoint/allow=gsm
endpoint/context=testing
If I had to guess.
After adding those field - changing incorrect fields
[test_to_production]
type=wizard
accepts_registrations=yes
sends_registrations=no
accepts_auth=yes
sends_auth=no
inbound_auth/username=test_to_production
inbound_auth/password=secret
endpoint/disallow=all
endpoint/allow=ulaw
endpoint/allow=alaw
endpoint/allow=gsm
endpoint/context=testing
The call PJSIPShowRegistrationInboundContactStatuses
still returns 0 found
jerry
Then you need to do basic troubleshooting based on your assumptions. The assumption is that it should be registered - so verify that the registration traffic is even getting to PJSIP. That can be done using a packet capture, or “pjsip set logger on”. If it isn’t then further isolate - verify ports, confirm PJSIP is listening.
I have these two enabled in pjsip.conf
[transport-udp]
type=transport
protocol=udp ;udp,tcp,tls,ws,wss,flow
bind=0.0.0.0
; UDP transport behind NAT
;
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.0.2.0/24
external_media_address=203.0.113.1
external_signaling_address=203.0.113.1
I enabled the logger -
I restarted asterisk on both machines
Still nothing. Either on the logger - or other command.
jerry
Well, I can say that you can’t have two transports bound to the same IP address and port like that.