SIP to number connection

Good morning,
I would like to launch such an extension that permanently connects me with an internal SIP number, e.g. 200, with a given telephone number.
I see it this way:
I run the script - how? via API? or maybe from a PHP server in asterisk? (I don’t know yet) with the given number.
ie: http://localhost:80/connect?from=fromTrunk&to=7666666666&internalConn=200

Asterisk from the fixed extension dials the call to this number and at the same time calls the given SIP / extension.
So that after lifting the handset by the extension number you have established connection:
SIP (internal, e.g. 200) with a given external number via a given access number (TRUNK).

?
How to realize it?

Call files or one of the many variants of “oriiginate”.

? What ‘call files’.
How to write it in extensions?

I have this: https://www.voip-info.org/asterisk-config-extensionsconf/

And this: …
exten => s,3,Dial(SIP/goodperson)
exten => s,4,Dial(VARIABLENUMBER)

How to call to variable number? How to take IT as changable number?
How to join this two calls?

You need to understand the basics before you try anything complex. You seem to have a fundamental understanding of what Dial() does; it supervises, as well as dials the call, so doetn’t exit until one party clears.

Also, you need to be prepared to search and read the documentation once given a hint.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+Call+Files
https://wiki.asterisk.org/wiki/display/AST/ManagerAction_Originate
https://wiki.asterisk.org/wiki/display/AST/Application_Originate
https://wiki.asterisk.org/wiki/display/AST/Creating+and+Manipulating+Channels+from+the+CLI

https://www.google.com/search?q=asterisk+click+to+cal

Thank You very much! :slight_smile: !!!

I have it :slight_smile: first working version, have to evaluate :slight_smile:

step 1.
add it into /etc/asterisk/extensions_custom.conf
(just edit form: http://ASTERISKIP/admin/config.php?display=configedit ):

[call-test-afya]
exten => 10,1,Set(TIMEOUT(digit)=5)
exten => 10,2,Set(TIMEOUT(response)=10)
exten => 10,n,Answer
exten => 10,n,NoOp("----START EXTENSION—")
exten => 10,n,Wait(1)
exten => 10,n,NoOp("—CALLING TO {CUSTOMER} USING: SIP {PBX}—")
exten => 10,n,Dial(SIP/{PBX}/{CUSTOMER})
exten => 10,n,NoOp("----STOP EXTENSION—")
;----calltestafya—;

step 2:
log in into console and type:

core reload

step 3:
do something (php/python script) , to generate (copy or create files with .call extension in: /var/spool/asterisk/outgoing )
they have to contain:

Channel: SIP/200 ; your internal phone you want to pick up
Callerid: AUTOMATIC CALL ; as you wish
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: call-test-afya ; my extension context
Extension: 10 ; my extension number
SetVar: CUSTOMER=123456789 ; where to call - change it by script
SetVar: PBX=freepbx.pl-XXXXXXXXX-OUT ; your SIP outgoing trunk, you find this name in: http://ASTERISKIP/admin/config.php?display=trunks

Thank You 4 help!