Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


13 posts

Geek
+1 received by user: 1


Topic # 115680 3-Apr-2013 13:24
Send private message

Hi All,

Just thought I'd post that I have successfully setup my asterisk box to forward calls to my mobile and retain the original  CallerID. (this means that my mobile shows the person calling home, not my home number) and I'm pretty sure it frees up the VoIP trunk channel as well

I'm using Asterisk 11 (from source) and I spent a while dissecting bits and pieces of information from google to find the solution was relatively simple, AND it still works if you answer, then blind transfer.

First I had to modify the function sip_sipredirect(...) which is in channels/chan_sip.c
" add_diversion(&p->initreq, p); " (see diff patch below)
this function appends the correct headers (which it doesn't do by default because its an "unofficial" standard)

------------------------------------------------------------------------------------------------------------
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 15a887f..0f7ab44 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -32770,6 +32770,7 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
                        domain = ast_strdupa(ldomain);
                }
        }
+       add_diversion(&p->initreq, p);

        ast_string_field_build(p, our_contact, "Transfer <sip:%s@%s>", extension, domain);
        transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq);
------------------------------------------------------------------------------------------------------------------

Then I simply used the Transfer() command in my dialplan

[incoming]
exten => ${VFXNUMBER},1,Transfer(${MOBILENUM})
exten => ${VFXNUMBER},n,Hangup()

Also note: I found that if you Transfer() but don't Hangup() it doesn't work

You can also Answer(), Play(Please wait while I transfer you), Transfer(), Hangup() and it still works

Hopefully this helps someone else

Regards,

Blair

Create new topic
3594 posts

Uber Geek
+1 received by user: 79

Trusted
WorldxChange

  Reply # 792900 4-Apr-2013 08:31
Send private message

Nice post Blair, thanks for contributing




Yes I am a employee of WxC (My Profile) ... but I do have my own opinions as well Wink

             

https://www.facebook.com/wxccommunications

27065 posts

Uber Geek
+1 received by user: 6508

Moderator
Trusted
Biddle Corp
Lifetime subscriber

  Reply # 792906 4-Apr-2013 08:44
Send private message

There is also some code on here that's been posted a few times that only requires some basic changes to dialparties.agi to enable SIP302 redirect headers. This is a lot easier for most people than having to recompile Asterisk!




13 posts

Geek
+1 received by user: 1


  Reply # 792927 4-Apr-2013 09:17
Send private message

sbiddle: There is also some code on here that's been posted a few times that only requires some basic changes to dialparties.agi to enable SIP302 redirect headers. This is a lot easier for most people than having to recompile Asterisk!



I did see those during my searching, It seems everyone is asking the "Asterisk Powers that be" why the Transfer() function doesn't include that functionality by default, or even as an option that can be enabled but is always met with "although everyone in the world uses it, its not an official standard"

I re-patched because I figured using Transfer() was cleaner than calling AGI scripts.. Is it possible to call an AGI script during a blind transfer? I've never used them. and would presume they only work when in the dialplan when specifically dialing an extension or relieving an incoming call

I'm slowly making my little Asterisk box do what its told, little milestone at a time haha.. (now that I've defeated the NAT beast)

Regards,
Blair

21464 posts

Uber Geek
+1 received by user: 4362

Trusted
Subscriber

  Reply # 793488 4-Apr-2013 20:51
Send private message

Oh, so this huge omission from asterisk has being sorted now? This is why I just gave up on it in the past since noone could tell me how to get it to transfer calls like my crappy linksys ATA was able to do.

Will have to have another play with it, to transfer wanted callers to the mobile, and unwanted ones and blocked ones to tell to go away and hang up on. The telco side blocking of 2talks and italks is useless because callers just get a busy signal when ID is blocked.




Richard rich.ms



13 posts

Geek
+1 received by user: 1


  Reply # 793688 5-Apr-2013 09:02
Send private message

richms: Oh, so this huge omission from asterisk has being sorted now? This is why I just gave up on it in the past since noone could tell me how to get it to transfer calls like my crappy linksys ATA was able to do.

Will have to have another play with it, to transfer wanted callers to the mobile, and unwanted ones and blocked ones to tell to go away and hang up on. The telco side blocking of 2talks and italks is useless because callers just get a busy signal when ID is blocked.


I presume this is on a toll free 0800 or similar? Originally I just Dial()'ed, however this ends up using both Trunks.

Unfortunately this patch its not part of the main code.. hopefully they will include it one day, but for now we're stuck patching out our sources or using AGI scripts.. but yeah, otherwise working fine.. (imagine trying to do this with a closed source package haha)

If you need a hand with your own setup just sing out.. took me a couple of days research, then just short of an hour with nano to patch and recompile (navigating the source was fun... trying to figure out what functions are what, which files they're in etc)

Currently it answers with "Press 1 for... Press 2 for.."
if you hit 1, it rings my desk phone (then vm), 2 transfers to my cell (with CID), you can also type an extension number or access VM... Eventually I'll add a ext&pin to let me transfer out to any number as well (say for using a friends phone to make a cell call, or from toll-bared numbers, etc)

Regards,



Blair Inglis

Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.