Autohints pjsip


#1

Hello!

Does autohints option works with PJSIP?
I’m trying to get device state from hints. I have lots of extensions so manually put them in context is not an option. However if i enable “autohints=yes” for default context - only SIP hints are created. I have chan_sip unloaded and only pjsip running. Enabling autohints gives me only this:

core show hint 100
100@default : SIP/100 State:Unavailable Presence:not_set Watchers 0

Is there a way to change that? I couldn’t find any info on whether i can change device state identifier or not.

Thanks!


#2

Autohints do work for PJSIP, but you’ll need to be specific in what exactly you are trying to achieve. Are you sure you aren’t actually wanting to use a pattern match instead?


#3

Hello jcolp,

Thanks for your reply. I have some small web app that shows me state of queue agents which relies on device state with (i enabled callcounter=yes in sip.conf).

core show hint exten

This works with SIP but i’m migrating to PJSIP and would like to do the same with it.
I’m not sure if i understand - what is pattern match?


#4

You stated originally that you were relying on hints. Extension state and device state are two separate things, and device state operates without extension state. Pattern matching in hints allows a single pattern match hint to be defined, and as specific hints are requested they are created.

I’m still confused over what exactly you are using things for and how.


#5

Oh, and if you haven’t restarted with chan_sip not loaded that is probably why it is still in there. The autohint doesn’t go away as a result of unloading, and they are created based on device state changes actually occurring within the system.


#6

Basing on “State” field of command

core show hints

I can see state of the extension and the reflect this information on my self-made dashboard (either it is idle, ringing, inuse or unavailable). This state change is enabled by callcounter=yes in sip.conf. I’m not familiar with pjsip enough yet but i couldn’t find the same option for it so i searched for how to create hints with this information (extension state) and found option “autohints” which basically did what i needed apart from the wrong technology (SIP instead of PJSIP). I hope this makes sense.

I have autoload off in modules.conf and didn’t load chan_sip at all and then restarted Asterisk. I can see that there is no chan_sip in loaded modules.


#7

Did you always use autohints?


#8

No, i don’t have autohints in version 11 and chan_sip but if i don’t enable this on version 16 i get this:

core show hints
There are no registered dialplan hints

while on version 11 it works without it.


#9

The chan_sip module would not have automatically created hints in Asterisk 11, so I’m not sure how it would have worked there unless something else was creating them. I’m also not sure why autohints aren’t working for you in the expected manner in the latest version.