Registration with callcentric sometimes fails. That is, it registers, but then at some point re-registration fails. I’ve turned off auth_rejection and set max_retries to infinite.
auth_rejection_permanent = no
max_retries = 0
What I’d like is some way to use the dialplan to see if a registration is up. From the system, I can use a bash script:
#!/bin/bash
if asterisk -rx “pjsip show registration 100” | grep -i “Rejected”
then
asterisk -rx “pjsip send registration 100”
fi
Can I do this from the dialplan ?
ExecIf ( registration 100 is down ? pjsip send register 100 )
How do I get the dialplan to see if 100 is down, and how do I re-register 100 from the dialplan ?
It can be done from the dialplan but first, why dont you find out why registration fails sometimes and try to fix that issue definively, also if you do this from the diaplan it be trigged only when you dial the extension , better use a cron job
1 Like
Tried DEVICE_STATE:
exten => s,n,Verbose( device state of incoming callc ${DEVICE_STATE(pjsip/100)} )
which showed it unavailable:
Verbose(“DAHDI/1-1”, " device state of incoming callc UNAVAILABLE ")
BUT iy was available, or at least registered:
100/sip:callcentric.com 100 Registered
Yeah, the System command was where I was going when I wrote the bash script. I’d prefer to have it in the dialplan, but looks like I’m back to Plan A.
thanks
I know this forum is not known for having line of “codes” passed by (or in this case line of dialplan) but I did something similar to what you are wanting, in this case I use the PJSIP Contact Variables to get my information
[test-user-agent]
exten => _X.,1,NoOp(PJSIP User-Agent)
same => n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(${EXTEN},contact)},status)})
same => n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(${EXTEN},contact)},user_agent)})
and then dial to the context with the exten of the endpoint you want to know about: “console dial XXXX@test-user-agent”
1 Like
Well no joy there either:
same => n,Verbose(${PJSIP_AOR(100,contact)})
same => n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(100,contact)},call_id)})
same => n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(100,contact)},status)})
same => n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(100,contact)},user_agent)})
PJSIP_AOR returned the contact, but PJSIP_CONTACT returned nothing:
Verbose(“DAHDI/1-1”, “100@@dee5d20aab451eeffda19de3f149be11”) in new stack
100@@dee5d20aab451eeffda19de3f149be11
NoOp(“DAHDI/1-1”, “”) in new stack
NoOp(“DAHDI/1-1”, “Unknown”) in new stack
NoOp(“DAHDI/1-1”, “”) in new stack
Sigh
It seems your AOR is with two “@” between the endpoint and the identifier, I have no clue why, but it seems that is the reason you can’t use it inside PJSIP_CONTACT.
With only one @ :
same => n,Verbose(${PJSIP_AOR(100,contact)})
same => n,Set(Aor-Contact=“100@dee5d20aab451eeffda19de3f149be11”)
same => n,NoOp(${PJSIP_CONTACT(${Aor-Contact},call_id)})
same => n,NoOp(${PJSIP_CONTACT(${Aor-Contact},status)})
same => n,NoOp(${PJSIP_CONTACT(${Aor-Contact},user_agent)})
no joy:
Verbose(“DAHDI/1-1”, “100@@dee5d20aab451eeffda19de3f149be11”) in new stack
100@@dee5d20aab451eeffda19de3f149be11
Set(“DAHDI/1-1”, "Aor-Contact=“100@dee5d20aab451eeffda19de3f149be11"”) in new stack
WARNING[11951][C-00000027]: func_pjsip_contact.c:143 pjsip_contact_function_read: Failed to retrieve information for contact ‘100@dee5d20aab451eeffda19de3f149be11’
NoOp(“DAHDI/1-1”, “”) in new stack
[Oct 17 13:13:28] WARNING[11951][C-00000027]: func_pjsip_contact.c:143 pjsip_contact_function_read: Failed to retrieve information for contact ‘100@dee5d20aab451eeffda19de3f149be11’
WARNING[11951][C-00000027]: func_pjsip_contact.c:143 pjsip_contact_function_read: Failed to retrieve information for contact ‘100@dee5d20aab451eeffda19de3f149be11’