Re: [Asterisk-Users] call-back example

2004-08-19 Thread Tobias Jönsson
On Wed, 18 Aug 2004, Maros RAJNOCH wrote:

 can anyone show me a exemple config for call-back?

 1) I call asterisk server from my cellular
 2) asterisk hang up my call (on d-channel)
 3) asterisk recall to my cellular and give me a PSTN tone, so
I can to pick up a call and to dial new phone number (via tone dialing)

I already do that, so here you are!

[remote]
exten = yourmsn/yourcellphoneno,1,Goto(callback,${CALLERIDNUM},1)

[intern]
exten = 0,1,Dial(Zap/g1)   ; I use overlap dialing at Zap/g1 but of course you could 
collect some digits by yourself or with DISA application

[callback]
exten = _X.,1,SetVar(callbacknr=${EXTEN})
exten = _X.,2,SetVar(PRI_CAUSE=16)
exten = _X.,3,Hangup
exten = h,1,Wait(5); try out your delay needed
exten = h,2,System(echo Channel: SIP/[EMAIL PROTECTED]  /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)


Regards,
Tobias Jönsson, Lund SE

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] call-back example

2004-08-19 Thread Peter Svensson
On Thu, 19 Aug 2004, Tobias Jönsson wrote:

 exten = h,2,System(echo Channel: SIP/[EMAIL PROTECTED]  /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. Asterisk can then read half a file. Just 
something to think about when choosing the location of the temporary file.

Peter


___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] call-back example

2004-08-19 Thread Tobias Jönsson
On Thu, 19 Aug 2004, Peter Svensson wrote:
 On Thu, 19 Aug 2004, Tobias Jönsson wrote:

  exten = h,2,System(echo Channel: SIP/[EMAIL PROTECTED]  /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

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] call-back example

2004-08-19 Thread Peter Svensson
On Thu, 19 Aug 2004, Tobias Jönsson wrote:

  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?

I drop the temporary file in /var/spool/asterisk/ which on the system in 
question is on the same file system as /var/spool/asterisk/outgoing/. I 
don't know what will happen if there is a directory in outgoing/.

Peter


___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[Asterisk-Users] call-back example

2004-08-18 Thread Maros RAJNOCH
Hi everybody,

can anyone show me a exemple config for call-back?

I need something like:

1) I call asterisk server from my cellular
2) asterisk hang up my call (on d-channel)
3) asterisk recall to my cellular and give me a PSTN tone, so
   I can to pick up a call and to dial new phone number (via tone dialing)

So in fact asterisk call to me and also call to third person
and switch-over these two calls.

Thanks.
___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users