<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=620571514-04102004>I
think I know why the Vars are getting "lost".</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=620571514-04102004>I
didn't realise that the Dial() command changes the channel the script is
executing in. For example if I run a SetVar before the dial it is set in
the CALLER's channel space. When running a macro in the Dial Command the
channel space becomes that of the CALLEE. </SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=620571514-04102004>So the
question is, is not being able to put ARGS on the the Dial command macro
option a bug. If it isn't how are you expected to share variables across
channel spaces without doing something silly like put it in a global
variable. If it is I shall raise it (once I know how to raise
bugs).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004>---------------------------------------------------------------</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><SPAN
class=620571514-04102004> -- Executing SetVar("<FONT
color=#ff0000>SIP/snom-ee1d</FONT>",
"CALLFILENAME=/tmp/call_logs/6101/20041004-143928-6107") in new
stack<BR> -- Executing Dial("<FONT
color=#ff0000>SIP/snom-ee1d</FONT>", "SIP/pingtel|10|tTM(record-start)") in new
stack<BR> -- Called pingtel<BR> --
SIP/pingtel-5a9c is ringing<BR> -- SIP/pingtel-5a9c answered
SIP/snom-ee1d<BR> -- Executing SetVar("<FONT
color=#ff0000>SIP/pingtel-5a9c</FONT>",
"CALLFILENAME=/tmp/call_logs//20041004-143929-6107") in new
stack</SPAN></FONT></DIV><SPAN class=620571514-04102004><FONT face=Arial
color=#0000ff
size=2>---------------------------------------------------------------</FONT></SPAN>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=620571514-04102004>thanks
for any help on this</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004>alex</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=620571514-04102004></SPAN></FONT> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Alex Barnes
<BR><B>Sent:</B> 04 October 2004 14:09<BR><B>To:</B>
asterisk-users@lists.digium.com<BR><B>Subject:</B> [Asterisk-Users] Macro's
and Var Scope's<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=695314912-04102004>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=695314912-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=695314912-04102004>I am having
difficulty getting my record phone call dial-plan script working. I
have tried the example record call scripts but they start recording before
they are actually connected to an end point, e.g. you get ringing or
announcements being recorded.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=695314912-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=695314912-04102004>It seems to
me that these are bugs with the Dial() command:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=695314912-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=695314912-04102004>1) Using M(x) in a
dial command does not allow argument to be passed. Using something like
"Dial(${ARG2},10,tTM(record-start,1111))" means that the macro cannnot be
found.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=695314912-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial><SPAN class=695314912-04102004><FONT size=2>2) Variables
are not passed from one context into another when using the M(x)
command. For example the variable <FONT face="Courier New">CALLFILENAME
</FONT><FONT face=Arial>set in <FONT face="Courier New">stdexten</FONT> cannot
be seen by </FONT><FONT face="Courier New">record-start </FONT><FONT
face=Arial>but can be seen if I use the <FONT
face="Courier New">Macro()</FONT> command rather than <FONT
face="Courier New">Dial()</FONT> with the <FONT face="Courier New">M(x)</FONT>
switch.</FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=695314912-04102004>If anyone can
offer any advice it would be much appreciated. Pls note the working method is
included but commented out I hope thats not confusing. Also <FONT
face="Courier New">record-cleanup</FONT> is called from the default context
when ever a call is hung-up (not sure if thats a good thing to do or
not).</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=695314912-04102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=695314912-04102004>If I set the vars
as globals then the script works perfectly but I assume this would go horribly
wrong once there are two or more calls connected.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=1></FONT> </DIV>
<DIV><SPAN class=695314912-04102004><FONT face="Courier New"
size=1>SCRIPT</FONT></SPAN></DIV>
<DIV><SPAN class=695314912-04102004><FONT face="Courier New"
size=1>----------------------------------</FONT></SPAN></DIV>
<DIV><SPAN class=695314912-04102004><FONT face="Courier New"
size=1>;-----------------------------------------------------------------------------<BR>[macro-stdexten]<BR>exten
=> s,1,Answer<BR>exten =>
s,2,Playback(transfer)
;play transfer (please hold whilst i try to conenct you)<BR> ;exten =>
s,3,Macro(record-start) ; WORKS but starts recording
before connect<BR> ;exten =>
s,4,Dial(${ARG2},10,tT)) ; WORKS but starts recording
before connect<BR>exten =>
s,3,SetVar(CALLFILENAME=/tmp/call_logs/${ARG1}/${TIMESTAMP}-${CALLERID})<BR>exten
=> s,4,Dial(${ARG2},10,tTM(record-start))<BR>exten =>
s,5,Goto(s-${DIALSTATUS},1)
; Jump based on status
(NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" size=1></FONT> </DIV>
<DIV><SPAN class=695314912-04102004><FONT face="Courier New"
size=1>;--<SNIP>--</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" size=1></FONT> </DIV>
<DIV><SPAN class=695314912-04102004><FONT face="Courier New"
size=1>;-----------------------------------------------------------------------------<BR>[macro-record-start]<BR> ;exten
=>
s,1,SetVar(CALLFILENAME=/tmp/call_logs/${ARG1}/${TIMESTAMP}-${CALLERID}) ;
WORKS but starts recording before connect<BR>exten =>
s,1,SetVar(STARTREC=true)<BR>exten =>
s,2,NoOp(${CALLFILENAME}) ; Debug<BR>exten =>
s,3,NoOp(${ARG1}) ; Debug<BR>exten =>
s,4,NoOp(${EXTEN}) ; Debug<BR>exten =>
s,5,Monitor(wav,${CALLFILENAME})<BR>exten => s,6,NoOp</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" size=1></FONT> </DIV>
<DIV><SPAN class=695314912-04102004><FONT face="Courier New"
size=1>;-----------------------------------------------------------------------------<BR>[macro-record-cleanup]<BR> ;exten
=> s,1,GotoIf($[${CALLFILENAME} = ${NULL}]?6:2) ; WORKS but starts
recording before connect<BR>exten => s,1,GotoIf($[${STARTREC} =
${NULL}]?6:2)<BR>exten => s,2,StopMonitor<BR>exten =>
s,3,System(/usr/local/bin/soxmix ${CALLFILENAME}-in.wav
${CALLFILENAME}-out.wav ${CALLFILENAME}.wav)<BR>exten =>
s,4,System(/usr/bin/notlame --preset phone ${CALLFILENAME}.wav
${CALLFILENAME}.mp3)<BR>exten => s,5,System(rm
${CALLFILENAME}*.wav)</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" size=1></FONT> </DIV>
<DIV><SPAN class=695314912-04102004><FONT face="Courier New" size=1>; End of
routine, return to calling point (note: NoOp required for GotoIf called from
priority 2)<BR>exten => s,6,NoOp</FONT></SPAN></DIV>
<DIV><BR></DIV>
<DIV> </DIV><BR><BR><FONT style="BACKGROUND-COLOR: #ffffff">
<DIV>
<DIV><FONT size=2>Dear Friends of Ubiquity Software:</FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>As you may have noticed, Ubiquity Software began using the
web domain ubiquity.com earlier this year in addition to the previously
established ubiquity.net for our website and email communications to
you. However, since that time, a dispute has emerged with respect to
actual ownership of the ubiquity.com domain.</FONT></DIV><BR>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>As an international software company founded over decade
ago, you can always reach Ubiquity Software under the website www.ubiquity.net
<<A href="http://www.ubiquity.net/" target=_BLANK><U><FONT
color=#800080>http://www.ubiquity.net/</FONT></U></A>> and via email
at @ubiquity.net. </FONT><FONT size=2>However, we have also chosen
to expand our domain to the more specific www.ubiquitysoftware.com <<A
href="http://www.ubiquitysoftware.com/" target=_BLANK><U><FONT
color=#0000ff>http://www.ubiquitysoftware.com/</FONT></U></A>> for
web and @ubiquitysoftware.com for email communications.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Please use either the historical ubiquity.net or begin to
use the new ubiquitysoftware.com domain for all email communications to
Ubiquity employees from now on. </FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Thank you.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>Regards,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>Ubiquity Software </FONT></DIV>
<DIV><FONT size=2>www.ubiquitysoftware.com <<A
href="http://www.ubiquitysoftware.com/" target=_BLANK><U><FONT
color=#0000ff>http://www.ubiquitysoftware.com/</FONT></U></A>>
</FONT></DIV>
<DIV><FONT color=#0000ff size=2><A
href="mailto:info@ubiquitysoftware.com"><U>info@ubiquitysoftware.com</U></A></FONT>
</DIV></DIV></BLOCKQUOTE></FONT></BODY></HTML>