Asterisk register extension

Hello,

Is it possible to register an extension through the dialplan in Asterisk if I know the host and port number?
I need that for mobile devices in order to send them a push notification to them, but this function it is done by another system, that’s why Asterisk should be able to send an Invite there, even if the extension is not at the moment registered in Asterisk.
I’m using realtime feature.
Thank you.

Seems to me that you don’t want to register, but rather to configure a static address. There are several ways of changing those on the fly, but not through the dialplan, except in as much as you can use System or AGI to do almost anything.

You can, of course, originate SIP calls to explicit URIs, from the dialplan.

@it_manager Are you trying to automate through a 3rd system or something like that the process of adding new extensions and peers?
Because its possible

The idea is like this, i have a SIP Proxy, and behind of this proxy - few Asterisk Boxes, using realtime sippeers. SIP Proxy is the one who is sending Push Notification messages to the Mobile Devices. So, when one extension is trying to call another one, Asterisk will fail to call him, because that extension is not registered at the moment, until i will not execute Push Notification script, that’s why i need to tell firstly to Asterisk that this extension is registered with SIP Proxy IP Address, then SIP Proxy will receive the INVITE from Asterisk and will send Push Notification to the mobile device.

@david551 - by configuring them with static ip address, means that those extension will be permanent online for the Asterisk, correct? This is not what i need unfortunately.

@Diego.Espinoza - not really, i just want to register one extension when someone is calling it, from the dialplan or from the system.

One option could be to use sipp with a small register scenario, and call it from the dialplan when i’m going to call that extension. This can be an option but i would prefer to avoid using external tools like sipp and do that with asterisk tools.

Thank you.

I really mean have a known IP address

The SIP proxy should register with Asterisk to do this properly.

Otherwise you have to temporarily configure a static address.

Yes, that’s true, the SIP Proxy is registering with the Asterisk, all good, when some extension is registering, the SIP Proxy is sending this message to Asterisk, so he is aware about peer location. But, in case of mobile application - they are not permanently online, so when they are idle, then they are not answering on any keepalive messages and SIP Proxy/Asterisk are automatically un-register them. And the only way to wake up them - is to send a push notification when the call comes in. But, SIP Proxy cannot send the push notification to them, until he is not receiving INVITE from Asterisk, which of course is not sending it because he doesn’t know where this peer is located at. If i could force the Asterisk to register that extension with SIP Proxy IP Address and port - then the issue will be fixed.
Thank you.

It’s contact address has the proxy as its domain name. In this context the proxy needs to be rewriting the domain in the request URI.

If your SIP Proxy is OpenSIPS you could use the Mid-Registrar module to relay registrations between your endpoint and Asterisk.

I don’t think they want the registration relaying, as he wants to make a call when the end device’s registration has timed out because iOS has put the app to sleep.

What I’m having trouble with is why he would ever want it unregistered, and therefore what is wrong with specifying it as a static host.

It may have something to do with an unstable IP address, but I can’t see how he will know the right IP address when doing the behind the back registration, so he’s still going to end up with a stale address.

Hi Guys,

Thank you for your support, and sorry for my English.

Yes, we are using the registration relay on the SIP Proxy, that’s fine, and everything is OK with SIP devices, the issue is only with Mobile Devices, let me show the connection schema below:

connection

So, every time when I’m calling extension 11 from 10, everything is ok, because ext 11 is permanently available on the Asterisk server based on keepalive messages. The issue is only when ext 11 is trying to ring ext.10, in this case, to reach it I need first to wake it up by sending a push notification message, if I’m sending this push notification message from Asterisk before sending an INVITE to it, then it’s fine, the Application is waking up and Asterisk is aware of its location (OpenSIPS IP Address). But, because of technical issues - I have to send the push notification message from the OpenSIPS server.

@david551 - by setting to that extension a static IP Address, which is SIP Proxy in my case, Asterisk will send that INVITE to the Proxy, but in this case, Asterisk will know such Extension always available, even if he did the log-out or deleted application, and this will cause other issues for us. For ex. before sending the call to the Device - sometimes we are checking if that device is logged-in or not, and based on that we are taking a different action. Also, we are monitoring some extensions, when they are online/offline and rtt for them, which of course will not work properly in this case.
This can be considered as a workaround - but I’m looking at something more reliable, to not affect our current setup, and do not cause performance issues.

Briefly, what i need is:

  1. When the call is coming in, to check in the local DB if that extension is an Push Notification Device and is logged-in at the moment
  2. If it is logged-in - check the status, if its offline register it manually.
  3. Send Invite to the Proxy - which will wake up it and will send invite.

Thank you.

The solution actually seems to be very simple:

exten => s,1,GotoIf([ {DEVICE_STATE(SIP/{ARG1})} = UNKNOWN | {DEVICE_STATE(SIP/${ARG1})} = UNAVAILABLE ]?2:3)

exten => s,2,Dial(SIP/${ARG1}@SIP_PROXY_IP,t)

Thank you all

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.