[Asterisk-Users] call-back example

Tobias Jönsson asterisk at tobiasjonsson.se
Thu Aug 19 04:48:57 MST 2004


On Thu, 19 Aug 2004, Peter Svensson wrote:
> On Thu, 19 Aug 2004, Tobias Jönsson wrote:
>
> > exten => h,2,System(echo "Channel: SIP/0${callbacknr}@rix1" > /tmp/${UNIQUEID}.call)
> > exten => h,3,System(echo "MaxRetries: 2" >> /tmp/${UNIQUEID}.call)
> > exten => h,4,System(echo "RetryTime: 60" >> /tmp/${UNIQUEID}.call)
> > exten => h,5,System(echo "WaitTime: 30" >> /tmp/${UNIQUEID}.call)
> > exten => h,6,System(echo "Context: intern" >> /tmp/${UNIQUEID}.call)
> > exten => h,7,System(echo "Extension: 0" >> /tmp/${UNIQUEID}.call)
> > exten => h,8,System(echo "Priority: 1" >> /tmp/${UNIQUEID}.call)
> > exten => h,9,System(mv /tmp/${UNIQUEID}.call /var/spool/asterisk/outgoing)
>
> There is a race in this solution of /tmp and
> /var/spool/asterisk/outgoing are on different file systems. Then the
> rename operation (mv) is not atomic but rather a copy.

Thank you Peter for pointing out that! My mistake. Unfortunately Asterisk
reads all files in the outgoing directory, not only *.call files, so it is
difficult to give a general solution to this. You can never be sure that a
file in a different directory is on the same file system, can you? Perhaps
the safiest would be to create a /var/spool/asterisk/outgoing/tmp
directory?

Regards,
Tobias Jönsson, Lund SE




More information about the asterisk-users mailing list