John French
2006-Dec-15 10:35 UTC
[asterisk-users] Trying to forward calls by using the Callee's context as the forward dial context
I'm simply trying to forward calls to users who have the call forwarding feature enabled (FWD Status and FWD Ph Number kept in the astDB). The problem is that I want users to be able to forward calls to numbers that they would normally be allowed to dial within their own context. (I don't want a local call only person forwarding to a long dist number, for example.) I'm able to get the channel context for SIP devices but not for IAX or Zap Devices. I need some pointers on getting IAXPEER to work and how to handle getting the ZAP context info. If there's an easier way, I'm all ears. Thanks. ; #####################Set Some Variables#################### exten => s,1,Set(DEVICE=${ARG1}) ;i.e. SIP/johns_phone exten => s,n,Set(Protocol=${CUT(DEVICE,/,1)}) ;Parse out SIP exten => s,n,Set(Phone=${CUT(DEVICE,/,2)}) ;Parse out johns_phone ;Stuff omitted for some amout of brevity.... ; #####################Make Forward Calls###################### ; We only want people to be able to forward to numbers they could normally call ; We'll have to somehow get their dialing contexts from the channel conf files. exten => s,n(Forward),NoOp() exten => s,n,GotoIf($["${Protocol}" = "SIP"]?SIPDev) exten => s,n,GotoIf($["${Protocol}" = "IAX2"]?IAXDev) exten => s,n,Goto(ZapDev) ;ok, they are an IAX device so use IAXPEER exten => s,n(IAXDev),Set(CalledUsersContext=${IAXPEER(${Phone}:context)}) exten => s,n,Goto(dial_time) ;ok, they are an SIP device so use SIPPEER exten => s,n(SIPDev),Set(CalledUsersContext=${SIPPEER(${Phone}:context)}) exten => s,n,Goto(dial_time) ;ok, they are an Zap device so use... Uhhhhh. exten => s,n(ZapDev),NoOp( I have no clue how to get the zap channel's context...) exten => s,n(dial_time),NoOp(======================> Chan Type ${Protocol}) exten => s,n,NoOp(======================> Chan Name ${Phone}) exten => s,n,NoOp(======================> Channel User's context ${CalledUsersContext}) exten => s,n,Dial(Local/${FWDNumber}@${CalledUsersContext}/n) Results at console on verbosity 9: SIPPEER() Works as advertised when I dial a SIP phone which has been call forwarded -- Executing NoOp("Zap/1-1", "======================> Chan Type SIP") in new stack -- Executing NoOp("Zap/1-1", "======================> Chan Name jf_linksys") in new stack -- Executing NoOp("Zap/1-1", "======================> Channel Users context longdistance_users") in new stack -- Executing Dial("Zap/1-1", "Local/5551212@longdistance_users/n") in new stack IAXPEER() Seems to be broken or I don't know how to use it properly. -- Executing NoOp("SIP/jf_linksys-08f20548", "======================> Chan Type IAX2") in new stack -- Executing NoOp("SIP/jf_linksys-08f20548", "======================> Chan Name johns_pc") in new stack -- Executing NoOp("SIP/jf_linksys-08f20548", "======================> Channel Users context ") in new stack -- Executing Dial("SIP/jf_linksys-08f20548", "Local/5551212@/n") in new stack
Marco Mouta
2006-Dec-15 11:03 UTC
[asterisk-users] Trying to forward calls by using the Callee's context as the forward dial context
Hi John, I would try to use on sip.conf and iax.conf and zapata.conf: on every "user (friend or whatever)" defined add this: [useraccount] .... setvar=mycontext=yourcontext ---------------------------------------------------------- This variable will become available for every user, so you just need to use it in your dialplan in extensions.conf Noop(User context:$mycontext) This is just an idea, please give some feedback if it helped and some how you will test if the forward number is valid or not :) Probably isn't hard , but is not clear yet for me and i'm busy :) Best Regards, Marco Mouta On 12/15/06, John French <jFrench@vividvoicedata.com> wrote:> > I'm simply trying to forward calls to users who have the call forwarding > feature enabled (FWD Status and FWD Ph Number kept in the astDB). The > problem is that I want users to be able to forward calls to numbers that > they would normally be allowed to dial within their own context. (I > don't want a local call only person forwarding to a long dist number, > for example.) I'm able to get the channel context for SIP devices but > not for IAX or Zap Devices. I need some pointers on getting IAXPEER to > work and how to handle getting the ZAP context info. If there's an > easier way, I'm all ears. Thanks. > > ; #####################Set Some Variables#################### > exten => s,1,Set(DEVICE=${ARG1}) ;i.e. SIP/johns_phone > exten => s,n,Set(Protocol=${CUT(DEVICE,/,1)}) ;Parse out SIP > exten => s,n,Set(Phone=${CUT(DEVICE,/,2)}) ;Parse out johns_phone > > ;Stuff omitted for some amout of brevity.... > > ; #####################Make Forward Calls###################### > ; We only want people to be able to forward to numbers they could > normally call > ; We'll have to somehow get their dialing contexts from the channel conf > files. > exten => s,n(Forward),NoOp() > > exten => s,n,GotoIf($["${Protocol}" = "SIP"]?SIPDev) > exten => s,n,GotoIf($["${Protocol}" = "IAX2"]?IAXDev) > exten => s,n,Goto(ZapDev) > > ;ok, they are an IAX device so use IAXPEER > exten => > s,n(IAXDev),Set(CalledUsersContext=${IAXPEER(${Phone}:context)}) > exten => s,n,Goto(dial_time) > > ;ok, they are an SIP device so use SIPPEER > exten => > s,n(SIPDev),Set(CalledUsersContext=${SIPPEER(${Phone}:context)}) > exten => s,n,Goto(dial_time) > > ;ok, they are an Zap device so use... Uhhhhh. > exten => s,n(ZapDev),NoOp( I have no clue how to get the zap channel's > context...) > > exten => s,n(dial_time),NoOp(======================> Chan Type > ${Protocol}) > exten => s,n,NoOp(======================> Chan Name ${Phone}) > exten => s,n,NoOp(======================> Channel User's context > ${CalledUsersContext}) > exten => s,n,Dial(Local/${FWDNumber}@${CalledUsersContext}/n) > > > Results at console on verbosity 9: > SIPPEER() Works as advertised when I dial a SIP phone which has been > call forwarded > -- Executing NoOp("Zap/1-1", "======================> Chan Type > SIP") in new stack > -- Executing NoOp("Zap/1-1", "======================> Chan Name > jf_linksys") in new stack > -- Executing NoOp("Zap/1-1", "======================> Channel Users > context longdistance_users") in new stack > -- Executing Dial("Zap/1-1", "Local/5551212@longdistance_users/n") > in new stack > > IAXPEER() Seems to be broken or I don't know how to use it properly. > -- Executing NoOp("SIP/jf_linksys-08f20548", > "======================> Chan Type IAX2") in new stack > -- Executing NoOp("SIP/jf_linksys-08f20548", > "======================> Chan Name johns_pc") in new stack > -- Executing NoOp("SIP/jf_linksys-08f20548", > "======================> Channel Users context ") in new stack > -- Executing Dial("SIP/jf_linksys-08f20548", "Local/5551212@/n") in > new stack > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20061215/733c7943/attachment.htm
Ricardo Martins
2006-Dec-15 11:19 UTC
[asterisk-users] Trying to forward calls by using the Callee's context as the forward dial context
Hi John, I?m very interested into this call forwarding capabilities and I solved this problem filtering on the web-script (in my case, php) the number the user can intert on the database. (I know it?s not an asterisk solution). There is an issue that I couldn?t handle. When I forward the call, I want to charge the user that the call was made FOR. How are you dealing with that? Going direct to the point, I just need to know - a tip would be apreciated either - how to translate/replace the FROM field of the forwarded call. Rgds, Ricardo. John French wrote:>I'm simply trying to forward calls to users who have the call forwarding >feature enabled (FWD Status and FWD Ph Number kept in the astDB). The >problem is that I want users to be able to forward calls to numbers that >they would normally be allowed to dial within their own context. (I >don't want a local call only person forwarding to a long dist number, >for example.) I'm able to get the channel context for SIP devices but >not for IAX or Zap Devices. I need some pointers on getting IAXPEER to >work and how to handle getting the ZAP context info. If there's an >easier way, I'm all ears. Thanks. > >; #####################Set Some Variables#################### >exten => s,1,Set(DEVICE=${ARG1}) ;i.e. SIP/johns_phone >exten => s,n,Set(Protocol=${CUT(DEVICE,/,1)}) ;Parse out SIP >exten => s,n,Set(Phone=${CUT(DEVICE,/,2)}) ;Parse out johns_phone > >;Stuff omitted for some amout of brevity.... > >; #####################Make Forward Calls###################### >; We only want people to be able to forward to numbers they could >normally call >; We'll have to somehow get their dialing contexts from the channel conf >files. >exten => s,n(Forward),NoOp() > >exten => s,n,GotoIf($["${Protocol}" = "SIP"]?SIPDev) >exten => s,n,GotoIf($["${Protocol}" = "IAX2"]?IAXDev) >exten => s,n,Goto(ZapDev) > >;ok, they are an IAX device so use IAXPEER >exten => >s,n(IAXDev),Set(CalledUsersContext=${IAXPEER(${Phone}:context)}) >exten => s,n,Goto(dial_time) > >;ok, they are an SIP device so use SIPPEER >exten => >s,n(SIPDev),Set(CalledUsersContext=${SIPPEER(${Phone}:context)}) >exten => s,n,Goto(dial_time) > >;ok, they are an Zap device so use... Uhhhhh. >exten => s,n(ZapDev),NoOp( I have no clue how to get the zap channel's >context...) > >exten => s,n(dial_time),NoOp(======================> Chan Type >${Protocol}) >exten => s,n,NoOp(======================> Chan Name ${Phone}) >exten => s,n,NoOp(======================> Channel User's context >${CalledUsersContext}) >exten => s,n,Dial(Local/${FWDNumber}@${CalledUsersContext}/n) > > >Results at console on verbosity 9: >SIPPEER() Works as advertised when I dial a SIP phone which has been >call forwarded > -- Executing NoOp("Zap/1-1", "======================> Chan Type >SIP") in new stack > -- Executing NoOp("Zap/1-1", "======================> Chan Name >jf_linksys") in new stack > -- Executing NoOp("Zap/1-1", "======================> Channel Users >context longdistance_users") in new stack > -- Executing Dial("Zap/1-1", "Local/5551212@longdistance_users/n") >in new stack > >IAXPEER() Seems to be broken or I don't know how to use it properly. > -- Executing NoOp("SIP/jf_linksys-08f20548", >"======================> Chan Type IAX2") in new stack > -- Executing NoOp("SIP/jf_linksys-08f20548", >"======================> Chan Name johns_pc") in new stack > -- Executing NoOp("SIP/jf_linksys-08f20548", >"======================> Channel Users context ") in new stack > -- Executing Dial("SIP/jf_linksys-08f20548", "Local/5551212@/n") in >new stack >_______________________________________________ >--Bandwidth and Colocation provided by Easynews.com -- > >asterisk-users mailing list >To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > > >