* You are viewing Posts Tagged ‘NoOp’

Asterisk ExecIf

Execif Executes dialplan application, conditionally. e.g.

If expr is true, execute and return the result of appiftrue(args).

If expr is true, but appiftrue is not found, then the application will return a non-zero value.

Syntax

ExecIf(expression?appiftrue[:...][:appiffalse[:...]])

Arguments

  • expression
  • execapp
    • appiftrue
    • appiffalse

 

User provided example:

;;; DTMF Testing software to test IVR system
;;;
exten => 1234,1,Answer()
same => n,Read(value,pleasePress1forSupportPress2forHelp,1,,10)
same => n,NoOp(${value})
same => n,ExecIf($[${value}=1]?Goto(suppot,1))
same => n,ExecIf($[${value}=2]?Goto(help,1))
same => n,Hangup()

exten=> support,1,Answer()
same => n,NoOp(you are at support section)
same => n,Hangup()

exten=> help,1,Answer()
same => n,NoOp(you are at help section)
same => n,Hangup()
 

Sending Fax Dialplan with Retry Attempt

Hello All,

I have a problem with Fax For Asterisk, the Successful Rate when sending Fax are very Low especially when we send the Fax just once. Now I’m trying to modify the dialplan so it will keep trying to send the fax for maximum 5 times at once and it only retry if the Sending Status has Error in it.

Here is the dialplan :

[fax-tx]

;Fax For Asterisk – Digium

exten => s,1,NoOp(**** SENDING FAX ****)

exten => s,n,Wait(6)

;zoel : Insert to MySQL

exten => s,n,MySQL(Connect connid localhost zzzz zzzz asterisk)

exten => s,n,GotoIf($["${MYSQL_STATUS}" = "0"]?:mysql_error,1)

exten => s,n,MYSQL(Query resultid ${connid} INSERT INTO fax_activity SET date=now(),faxfile=”${FAXFILE}”,faxtxnumber=”${FAXTXNUMBER}”,faxresult=”Sent to Spooler”,faxpages=”${FAXPAGES}”,faxstatus=”${FAXERROR}”,faxline=”${CHANNEL}”)

exten => s,n,MYSQL(Disconnect ${connid})

;zoel : End Insert to MySQL

; Set FAXOPTs

exten => s,n,NoOp(**** SETTING FAXOPT ****)

exten => s,n,Set(FAXOPT(ecm)=yes)

exten => s,n,Set(FAXOPT(headerinfo)=TEST FAX)

exten => s,n,Set(FAXOPT(localstationid)=1234567)

exten => s,n,Set(FAXOPT(maxrate)=14400)

exten => s,n,Set(FAXOPT(minrate)=2400)

; Send the fax

exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 1 : ${FAXFILE} : ${FAXOPT(error)} ****)

exten => s,n,SendFAX(${FAXFILE})

;zoel : Add Retry Attempt 2

exten => s,n,GotoIf($["${FAXOPT(error)}" = "NO_ERROR"]?FaxStop:RetryAttempt2)

;===================== The Call Stop Here … L

exten => s,n,Wait(6)

exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 2 : ${FAXFILE} : ${FAXOPT(error)} ****)

exten => s,n,SendFAX(${FAXFILE})

;zoel : Add Retry Attempt 3

exten => s,n,GotoIf($["${FAXOPT(error)}" = "NO_ERROR"]?FaxStop:RetryAttempt3)

exten => s,n(RetryAttempt3),Wait(6)

exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 3 : ${FAXFILE} : ${FAXOPT(error)} ****)

exten => s,n,SendFAX(${FAXFILE})

;zoel : Add Retry Attempt 4

exten => s,n,GotoIf($["${FAXOPT(error)}" = "NO_ERROR"]?FaxStop:RetryAttempt4)

exten => s,n(RetryAttempt4),Wait(6)

exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 4 : ${FAXFILE} : ${FAXOPT(error)} ****)

exten => s,n,SendFAX(${FAXFILE})

;zoel : Add Retry Attempt 5

exten => s,n,GotoIf($["${FAXOPT(error)}" = "NO_ERROR"]?FaxStop:RetryAttempt5)

exten => s,n(RetryAttempt5),Wait(6)

exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 5 : ${FAXFILE} : ${FAXOPT(error)} ****)

exten => s,n,SendFAX(${FAXFILE})

; Hangup! Print FAXOPTs

exten => s,n(FaxStop),NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})

exten => s,n,NoOp(FAXOPT(filename) : ${FAXOPT(filename)})

exten => s,n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})

exten => s,n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})

exten => s,n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})

exten => s,n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})

exten => s,n,NoOp(FAXOPT(pages) : ${FAXOPT(pages)})

exten => s,n,NoOp(FAXOPT(rate) : ${FAXOPT(rate)})

exten => s,n,NoOp(FAXOPT(remotestationid) : ${FAXOPT(remotestationid)})

exten => s,n,NoOp(FAXOPT(resolution) : ${FAXOPT(resolution)})

exten => s,n,NoOp(FAXOPT(status) : ${FAXOPT(status)})

exten => s,n,NoOp(FAXOPT(statusstr) : ${FAXOPT(statusstr)})

exten => s,n,NoOp(FAXOPT(error) : ${FAXOPT(error)})

;zoel : Insert to MySQL fax_activity

exten => s,n,MySQL(Connect connid localhost zzzz zzzz asterisk)

exten => s,n,GotoIf($["${MYSQL_STATUS}" = "0"]?:mysql_error,1)

exten => s,n,MYSQL(Query resultid ${connid} INSERT INTO fax_activity SET date=now(),faxfile=”${FAXOPT(filename)}”,faxtxnumber=”${FAXTXNUMBER}”,faxresult=”${FAXOPT(status)}”,faxpages=”${FAXOPT(pages)}”,faxstatus=”${FAXOPT(error)}”,faxline=”${CHANNEL}”)

exten => s,n,MYSQL(Disconnect ${connid})

;zoel : Insert to MySQL fax_activity

exten => mysql_error,1,Noop(“Error Connection Mysql”)

exten => mysql_error,n,Macro(hangupcall)

I know the dialplan above is not working cause it keep hangup after SendFax for the 1st time, and it just stop.

So is there any of you guys know how to fix this or is there any otherway so I can achieve it ?

Thanks

Regards,

ZH

DTMF dropping in Read Command

Hello listers,

I have a couple of 1.4.37 through 1.4.42 boxes
running at different sites. These systems run a fairly simple IVR that uses
waitexten and Read to get credentials and plow on through a set of contexts.
I am experiencing two problems in my setup:

1. In environments where DAHDI is the trunk of choice, this snippet
drops digits, especially if the user attempts to key them quickly. It also
mysteriously hangs up (autofallthrough=yes) if they key them too slowly

exten => s,1,Set(chktime=0)

exten => s,n,Read(digitacct,entacct,17,skip,1,10)

exten => s,n,Gotoif($[${LEN(${digitacct})} < 1]?checking,t,1)

exten => s,n,Read(digitpass,entpin,5,skip,1,10)

2. This context will randomly hang up the call when the user presses 1

[checking]

Exten => s,1,noop()

exten => s,n,Set(BALPLAY=${balance})

exten => s,n(chkdetail),Background(${BALPLAY})

exten => s,n(aftbal),Background(aftbal)

exten => s,n,WaitExten(6)

exten => s,n,Goto(checking,t,9)

exten => s,n,Goto(checking,s,chkdetail)

exten => 1,1,Goto(checking,s,chkdetail)

Any ideas?

Thanks in advance

Danny Nicholas

Problem with Atxfer for the calling party

Good morning,

I have not solved this problem yet, but, I found that the source of
the problem are my macros. For example, I have this context:

context ramais {
101 => &dial_sip(exten1);
102 => &dial_sip(exten2);
103 => &dial_sip(exten3);
};

All these extensions use the dial_sip macro, I have changed this context
to use the Dial application instead of dial_sip macro, it worked fine.
The problem is that when i use the macro, the current context is changed
to the dial_sip context, the dial_sip context is automatically created
by asterisk when i use any macro and of fact this context doesn’t have
the ramais context included. Is there some way to specify on which
context the macro will run?

On Mon, 2011-10-31 at 09:09 -0200, Antonio Modesto wrote:

> Good Morning,
>
> I have an asterisk18-1.8.7.1 running on a FreeBSD 8.2-STABLE, and it
> is working well so far, i’m just having some problems with atxfer.
>
> I have written this macro to dial sip extensions:
>
> macro dial_sip(exten) {
> Verbose(2,”==> Chamando a MACRO dial_sip – ponto 1 macros.ael
> < ==");
> Verbose(4,”====> Macro dial_sip iniciada.”);
> ChanIsAvail(SIP/${exten});
> Verbose(2,”==> ${AVAILORIGCHAN}”);
>
> if (“${AVAILORIGCHAN}” != “”)
> {
> Verbose(4,”====> SIP/${exten} parece estar disponivel,
> vou disca-lo agora.”);
> Set(FromExt=${CALLERID(num)});
> System(/bin/sh /var/spool/asterisk/calllog/log.sh
> SIP/${FromExt} SIP/${exten} SIP-TO-SIP);
> Verbose(4,”====> System status: ${SYSTEMSTATUS}”);
> Dial(SIP/${exten},${SIP_DIAL_TIMEOUT},Ttr);
> Hangup();
> }
> else
> {
> Verbose(2,”====> SIP/${exten} nao esta disponivel.”);
> Hangup();
> };
>
>
> NoOp(“From ${MACRO_EXTEN} to ${exten});
> System(${CALLLOGDIR}/log.sh ${exten});
>
> return;
> };
>
> It is working, but the calling party is not able to transfer the calls
> because asterisk doesn’t wait all the digits be typed, it tries to
> transfer the call when the first digit is pressed (We use 3 digits
> extensions):
>
> [Oct 31 09:04:01] WARNING[2926]: features.c:2315 builtin_atxfer:
> Extension ’1′ does not exist in context ‘dial_sip’
> == Spawn extension (dial_sip, ~~s~~, 11) exited non-zero on
> ‘SIP/modesto-0000000d’
> [Oct 31 09:04:03] WARNING[2926]: features.c:2319 builtin_atxfer: No
> digits dialed for atxfer.
>
> Does anyone have suggestions?
>
> Regards.
>
> –
> _____________________________________________________________________
> — Bandwidth and Colocation Provided by http://www.api-digital.com
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users

(no subject)

Karim Mardhani http://lists.digium.com/mailman/listinfo/asterisk-users> wrote:
>* Hi everyone,*>* *>* I am trying to get Meetme to return back to the context from where it*>* joined the meetme. For example a user uses the following context to join a*>* conference, once user hangs up I would like to continue executing the rest*>* of the dialplan. But when caller hangs up from the conference I see on CLI*>* that meetme exited with non-zero status but none of the rest of the*>* dialplan is executed. Please help. I am using asterisk 1.6.2.20*>* *>* [default]*>* exten => _XXXX,1,MeetMe(1000,1pdMX)*>* exten => _XXXX,n,noop(returned from meetme) ;After user hangs up should*>* come here*>* exten => _XXXX,n,SoftHangup(${ORIG_CALLER})*>* exten => _XXXX,n,SoftHangup(${CONF_CALLER})*>* exten => _XXXX,n,Hangup*>* exten => h,1,noop(default-end)*>* exten => h,n,SoftHangup(${ORIG_CALLER})*>* exten => h,n,SoftHangup(${CONF_CALLER})*>* exten => h,n,Hangup*
That’s not how Asterisk works. When the caller hangs up, execution of
the current dialplan extension stops, and control passes to the ‘h’
extension, if one exists in the current context.

Any processing you want to do when the caller hangs up must be done
in the ‘h’ extension. Cheers

Thanks Tony for the quick response. As you would see I have the h
extension defined but execution doesn’t go to that either.

Tony