SIP Tranfer while call in progress

Hello everybody,
i’m setting up a kind of lookup server.

i’ll try to explain how it’s suppose to work:

  • asterisk receives a call from our gateway
  • while the call is still in PROGRESS (this is mandatory) asterisk runs a very simple agi script
  • after agi has finished, asterisk tranfers the call back to our gateway to an arbitrary extension.

another important aspect is the following:
the protocol used is SIP (becouse of speed).
i need to implement a behaviour such that of NOTRANSFER=NO in IAX2

i’m going quite crazy. is there a way to do this?

i tried the TRANSFER command but with no good results.
any idea?

ok, TRANSFER works
but i have to pass only the desired number as argument, if i specify TECHNOLOGY/ACCOUNT/NUMBER transfer does not work.

but there is still another point.
the CLI (calling number) is cancelled.

here is my dialplan

exten => _X.,1,noop(incoming call)
exten => _X.,n,agi(my_agi_script,${ARG},…)
exten => _X.,n,tranfer(${NEW_EXTENSION})

any ieda?
thanks in advice.

Transfer requires that the technology match the current technology, but you can specify it. The rest of the address is in the context of the upstream switch, not Asterisk, so ought to be in user@ip-address format, although it appears that Asterisk will add the @ip-address, which is probably OK with upstream switches that are back to back user agents, rather than proxies.

The CLI will be sent from the upstream switch. There is no CLI information associated with Transfer. Assuming the call hasn’t been answered by your AGI script, Asterisk simply sends a SIP redirect response, where the only useful information is the new target address. If the call has been answered, it sends a SIP REFER request, although there are bugs in the error handling for this which are only fixed in the trunk version. Again the SIP REFER only effectively provides the new target address; the upstream switch will re-make the call with the original CLI information.