I want to hang the call just after answered.
exten => _3XXXXXXXXXX,1,Set(CALLERID(num)=1234567890)
same => n,MixMonitor(${UNIQUEID}.wav)
same => n,Dial(SIP/${EXTEN:1}#provider,,M(hang))
same => n,StopMixMonitor()
same => n,Hangup()
[macro-hang]
exten => s,1,Hangup()
any idea? I've tried a macro, but its not working.
From asterisk doc
M(macro[^arg[^...]]):
macro - Name of the macro that should be executed.
arg - Macro arguments
Execute the specified <macro> for the *called* channel before connecting to the
calling channel. Arguments can be specified to the Macro using '^' as a
delimiter. The macro can set the variable ${MACRO_RESULT} to specify the
following actions after the macro is finished executing:
${MACRO_RESULT}: If set, this action will be taken after the macro
finished executing.
ABORT: Hangup both legs of the call
CONGESTION: Behave as if line congestion was encountered
BUSY: Behave as if a busy signal was encountered
CONTINUE: Hangup the called party and allow the calling party to
continue dialplan execution at the next priority
GOTO:[[<context>^]<exten>^]<priority>: Transfer the call to the
specified destination.
Both ABORT and CONTINUE should do what you want.
Use Dial's L option. This way you can adjust the length of the call. From https://www.voip-info.org/asterisk-cmd-dial :
L(x[:y][:z]): Limit the call to ‘x’ ms, warning when ‘y’ ms are left, repeated every ‘z’ ms).
Note: If you will make the calls to a SIP provider, they will round up the up time (if you set L(1), even if it is 1 ms it will count as 1 second). Also, they will most likely suspend your account for wangiri fraud.
Related
As far as I know, MPI_BUFFER_ATTACH must be called by a process if it is going to do buffered communication. But does this include the standard MPI_SEND as well? We know that MPI_SEND may behave either as a synchronous send or as a buffered send.
You need to call MPI_Buffer_attach() only if you plan to perform (explicitly) buffered sends via MPI_Bsend().
If you only plan to MPI_Send() or MPI_Isend(), then you do not need to invoke MPI_Buffer_attach().
FWIW, buffered sends are error prone and I strongly encourage you not to use them.
MPI_Buffer_attach
Attaches a user-provided buffer for sending
Synopsis
int MPI_Buffer_attach(void *buffer, int size)
Input Parameters
buffer
initial buffer address (choice)
size
buffer size, in bytes (integer)
Notes
The size given should be the sum of the sizes of all outstanding
Bsends that you intend to have, plus MPI_BSEND_OVERHEAD for each Bsend
that you do. For the purposes of calculating size, you should use
MPI_Pack_size. In other words, in the code
MPI_Buffer_attach( buffer, size );
MPI_Bsend( ..., count=20, datatype=type1, ... );
...
MPI_Bsend( ..., count=40, datatype=type2, ... );
the value of size in the MPI_Buffer_attach call should be greater than the value computed by
MPI_Pack_size( 20, type1, comm, &s1 );
MPI_Pack_size( 40, type2, comm, &s2 );
size = s1 + s2 + 2 * MPI_BSEND_OVERHEAD;
The MPI_BSEND_OVERHEAD gives the maximum amount of space that may be used in the buffer for use by the BSEND routines in using the buffer. This value is in mpi.h (for C) and mpif.h (for Fortran).
Thread and Interrupt Safety
The user is responsible for ensuring that multiple threads do not try to update the same MPI object from different threads. This routine should not be used from within a signal handler.
The MPI standard defined a thread-safe interface but this does not mean that all routines may be called without any thread locks. For example, two threads must not attempt to change the contents of the same MPI_Info object concurrently. The user is responsible in this case for using some mechanism, such as thread locks, to ensure that only one thread at a time makes use of this routine. Because the buffer for buffered sends (e.g., MPI_Bsend) is shared by all threads in a process, the user is responsible for ensuring that only one thread at a time calls this routine or MPI_Buffer_detach.
Notes for Fortran
All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. In Fortran, MPI routines are subroutines, and are invoked with the call statement.
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran.
Errors
All MPI routines (except MPI_Wtime and MPI_Wtick) return an error value; C routines as the value of the function and Fortran routines in the last argument. Before the value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job. The error handler may be changed with MPI_Comm_set_errhandler (for communicators), MPI_File_set_errhandler (for files), and MPI_Win_set_errhandler (for RMA windows). The MPI-1 routine MPI_Errhandler_set may be used but its use is deprecated. The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarentee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible.
MPI_SUCCESS
No error; MPI routine completed successfully.
MPI_ERR_BUFFER
Invalid buffer pointer. Usually a null buffer where one is not valid.
MPI_ERR_INTERN
An internal error has been detected. This is fatal. Please send a bug report to mpi-bugs#mcs.anl.gov.
See Also MPI_Buffer_detach, MPI_Bsend
Refer Here For More
Buffer allocation and usage
Programming with MPI
MPI - Bsend usage
I use ARI to call 2 endpoints and Bridget them.
I want to hold or play media or play MOH call1 until endpoint2 answer call and then Bridget them.
I tried this plan but PlayBack, BackGround, MusicOnHold all of them block the thread until playing is finished and then call endpoint2.
exten => 107,1,NoOp()
same => n,Answer()
same => n,MusicOnHold(default,10)
#same => n,BackGround(silence/2&hello-world)
same => n,Dial(Local/***#from_internal_testing,U(default^postAnswer^1)) same => n,Hangup()
Are you really using ARI (i.e. Asterisk REST API)? I do not see that you are calling Stasis application from the dialplan. However, this operation should be invoked before you hand over the control over your channel to ARI.
All the methods mentioned above are suppored by ARI in the context “Channels”. The related specification is available here: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Channels+REST+API
What you trying to do do not require anything like that, just use app_queue
https://wiki.asterisk.org/wiki/display/AST/Building+Queues
If for some reason you still want do all that youself, you can use TIMEOUT(), dial via Local, conference etc.
What are the commands that I have to use to STOP or START an Oracle AQ Queue?
I need to STOP the queue in order to perform maintenance and analysis, and later START the queue once the analysis is complete.
You use the package DBMS_AQADM.
To STOP a queue the command looks like this:
BEGIN
DBMS_AQADM.STOP_QUEUE(queue_name => 'QUEUE_NAME');
END;
The optional paremeter "wait" for this procedure has the following behavior:
Specifies whether to wait for the completion of outstanding
transactions. TRUE means wait if there are any outstanding
transactions. In this state no new transactions are allowed to enqueue
to or dequeue from this queue. FALSE means return immediately either
with a success or an error.
And to START a queue it looks like this:
BEGIN
DBMS_AQADM.START_QUEUE(queue_name => 'QUEUE_NAME');
END;
You may have to add "SYS" as prefix for the package, depending on your permissions.
Often I find that I want to stop only dequeue. Then I have to use the extra options on START_QUEUE() like so
execute DBMS_AQADM.STOP_QUEUE (queue_name => 'schema.queue', enqueue => FALSE, dequeue => TRUE);
so i need to use a variable from a context that a caller called to the context that the called party uses, so i have a code like this
[calledContext]
exten => s,1,goto(waits)
same => n,goto(playmessage)
same => n(waits),set(a=0)
same => n(waits2),wait(5)
same => n,GotoIf($[${a} = 0]?waits2:hang)
same => n(playmessage),noop(${randomId})
same => n(hang),hangup();
[callerContext]
exten => 012345,1,Noop()
same => n,set(randomId=523)
same => n,Dial(SIP/09201234567,20,G(calledContext^s^1)g)
same => n,hangup()
heres my problem, in the calledContext context, when i use noop() on ${randomId}, nothing is displayed, how do i pass the value of the randomId from callerContext to calledContext?
SHARED is not what you want here.
The G option in Dial is one of those fun options that sends the two channels involved in the Dial operation to different places. Both are going to be sent to the Context/Extension you specified, which - given the names of the contexts - is probably not what you want. The called party gets sent to priority+1; the calling party priority.
That is, I'd expect the called party to start executing at calledContext,s,2 and the calling party to start executing at calledContext,s,1. But that's ancillary to your issue.
A variable set on an inbound channel can be passed to the channels it dials using channel variable inheritance. That is:
exten => 012345,1,Noop()
; Using a single underbar will set randomId on all channels this
; channel creates, but will not continue to propagate further
same => n,set(_randomId=523)
; Using two underbars will cause the variable to always propagate
same => n,set(__someOtherId=111)
same => n,Dial(SIP/09201234567,20,G(calledContext^s^1)g)
same => n,hangup()
Using the _ or __ will cause the variables to be set on the called party. If you want the variables to continue to propagate to channels the called party may also call, then use __.
Asterisk use concepts of CHANNEL or leg.
So in your call you have 2 channel, each one have independent variables and control structure
You can see name of bridged channels by BRIDGEPEER
http://www.voip-info.org/wiki/view/Asterisk+Detailed+Variable+List
You can get variables of other channel by using function SHARED maybe.
http://www.voip-info.org/wiki/view/Asterisk+func+shared
For see variables set in current channel you can use application DumpChan
I am writing a dialplan in Asterisk where I am required to implement a bookmarking feature. If a user calls in and the call gets disconnected, on redial the user must be taken to the exact same clip on which the call was dropped or disconnected last. The dialplan (with bookmarking feature) currently looks something like so:
[some-context]
exten => 0,n,System(progressmarker.sh ${CALLERID(num)} ${CONTEXT})
exten => 0,1,Background(wav1)
exten => 0,n,Background(wav2)
There are hundreds of such commands. progressmarker takes the context and puts it into a file. When the user wants to continue the old session, it starts from the last context the user was in. If the call gets dropped after wav1 or wav2, the user should start from wav1 or wav2 and not from the last context.
There is one way of doing this:
exten => 0,n(wav1),Background(wav1)&System(progressmarker.sh ${CALLERID(num)} ${CONTEXT} wav1)
But you can see this way is inelegant and cumbersome especially since there are hundreds of such commands. Is there a better way of implementing the bookmarking feature?
One way to do this is to employ the h extension. This is the extension that gets called when the channel encounters a hangup. The solution would look like so:
Keep saving the priority in a global variable.
Implement the hangup extension for each context. The channel variables such as last context, extension and priority are all accessible (contrary to what the documentation says). The extension will look something like so:
exten => h,1,System(<Execute a script here that saves the last context, extension and priority to a file that can be read later and control returned here.>)