Asterisk/13.9.1. how tu check extensions login or no

hi… :slight_smile:
For example I have 2 extensions 1302 and 1301 can login and logout
In extension 1301 I want to call 1302 before connecting dear should check first 1302 already login or not.?
Let’s say this =>
exten => 1302,1,NoOp(call, ${CALLERID(NUM)}, number, ${EXTEN})
same => n,Hangup
Still static
Please give solution ??? :slight_smile:

No special code is needed. The call to the not logged in extenion will fail immediately. and the dialplan will continue. You may want to look at the & dial string notation, though.

So I can not check the active extension
For example 1302 is active
I checked in extension 1301.
example:
Exten => 1302.1, NoOp (call, $ {CALLERID (NUM)}, number, $ {EXTEN})

How does it (Exten => 1302) get dynamic?
I have a need to check her or her extension extension when contacted

You are confusing extensions and devices.

The easiest way to check is simply to call and then look at the hangup cause and or dialstatus.

You can use the DEVICE_STATE function to check the state a faction of a second before the call.

For some channel technologies, there is a facility to automatically add a dialplan line with a given context and extension, and with priority one, when the device is registered, so that the extension will not be found if the device is not there.

thank you
Is there a link for setting up PJSIP Realtime connecting database?
Or how to create PJSIP from the database?

This is a yesterday’s example
exten => 1302,1,NoOp(call, ${CALLERID(NUM)}, number, ${EXTEN})
same => n,Set(ConnectedLineIDNum=${EXTEN})
same => n,GotoIf(${REGEX(“PJSIP/${EXTEN}”,${DB(Queue/PersistentMembers/support)})}?*1-active,1:*1-nonActive,1)

exten => *1-active,1,NoOp(Extension Active, ${ConnectedLineIDNum})
same => n,Dial(PJSIP/${ConnectedLineIDNum},10)
same => n,DumpChan()
same => n,Hangup

exten => *1-nonActive,1,NoOp(Extension Non Active)
same => n,Playback(pbx-invalid)
same => i,Hangup

Extension 1302 is already registered in PJSIP. So I am calling extension 1302 in extension 1301.
So how does extension 1302 (exten => 1302) not static?
Is it possible to use variables like this (exten => $ {EXTEN}, 1, NoOp ())?
I mean any extension that calls 1302 or 1300 and others. Dear take the extension in the call? what’s the solution

That would be pattern matching which is a commonly used and documented[1] thing of Asterisk.

[1] http://asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-DP-Basics-SECT-3.html#asterisk-DP-Basics-SECT-3.6

Thanks for my try
Oh he i tried the documented I already follow
https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime#SettingupPJSIPRealtime-ConfiguringODBC
PJSIP
Can not connect to database whether there is a solution ?