Asterix and sip "replaces" header support

Hello there, I’ve been searching for a while for a solution for my needs, and i couldn’t come up with one.

I’m trying to add Apple push notification support to our Asterisk server and our iOS dialer app.
The integration with Apple is pretty easy, i use PHPAGI to communicate with Apple servers.

The problem i’m struggling with is the pickup procedure,
I know i have to use something called “Replaces” sip-header but i can’t find if Asterisk support that.
I want to come up with something like the following:
Let’s say extension 1000 wants to call extension 1001, So:

  1. 1000 dials to 1001.
  2. Asterisk puts the call on hold, then runs php script that sends push notification to the destination with “local tag, remote tag and call id”.
  3. The Dialer at the destination gets the push notificatin and then sends back INVITE with the Replaces header.
  4. Asterisk gets the INVITE pcaket and resume the call.
  5. 1000 and 1001 are talking.

Any suggestions?
Tnx alot!

Standard Asterisk doesn’t support the sending of REFER/Replaces, which is the correct way of achieving your push notification within the SIP protocol. It only supports simple REFER, i.e. blind transfer.

(As technical points, note that callers need not have an extension number, and the Asterisk implementation of INVITE/Replaces doesn’t use the extensions number, only the call-ID.)

chan_sip, at least, does support incoming INVITE/Replaces and REFER/Replaces, but it might not do so well if the replaced leg isn’t within Asterisk.

All of the legs are within Asterisk,
So do you think i can achieve my goals with asterisk? i didn’t get the bottom-line of your reply.
tnx

I’m not convinced you can do it in the way you describe, because I don’t think you can access the tags.

Also, on closer reading, there is nothing to replace. You can only replace a SIP leg and the leg you would be replacing would be the outgoing leg to B, but you are not making an outgoing call to B! Parking does not create a SIP leg, and you are not trying to replace the A side leg.

However, I do not understand why you are trying to do, what appears to be a straightforward call, in such a convoluted way.

If by second line, you meant the bit in parentheses, extension numbers only have meaning in Asterisk, and, even if you generalise them to include SIP URI user parts, there is no requirement to have a user part on a SIP URI. When Asterisk receives INVITE/Replaces, and the call ID and tags are known, it completely ignores the user part of the SIP URI.

If, for some strange reason, you want both legs to be incoming, you should use the Park feature.

Sorry maybe i’m a bit misunderstood,
What i’m trying to do is to wake up iPhone voip softphone application with push notification(After iOS 10 apps can’t run in background more then 10 minutes, and because of that extension become unavailabe on voip apps),
So when A wants to reach B, asterisk supposed to park the call until B is registered again and send acknowledgement somehow(maybe with REPLACES header).
asterisk supposed the catch this acknowledgement and resume the parked call, so A and B can have a regular call after.
Is it clearer now?

Park the call and send the parking lot extension number to the iPhone. I suspect you will need to specify the lot number explicitly when parking, as you will lose control when it actually parks.

Alternatively, send the notification, then pause long enough for the iPhone to wake up, before sending the actual call.

Alright, i’ll do so.
How do I park call and get lot number programtically? i couldn’t find any tutorials or examples online about parking and resuming call on freepbx?

We can’t answer FreePBX questions here. For that you need https://community.freepbx.org/ although I suspect you do it with the customisation features that allow you to directly use Asterisk.