asterisk entry point to a SIP dialplan - sip

I understand this should be really easy but I can't find my way around the asterisk configuration files to do this.
What I need in an entry point for a external SIP call to execute an asterisk script. To keep things simple let's say I want to execute something like this:
[my888app]
exten => 888,1,Answer()
exten => 888,2,SayDigits(1234)
exten => 888,3,Hangup
The user will dial this particular 888 SIP extension in the form:
sip:888#mydomain.com
This is not an internal call, the call comes from another server, to test I'm using this Phono sample and the call is getting onto the asterisk server ok, the problem is that I have no idea how to route it to my888app. Already tried /etc/asterisk/sip_general_custom.conf without luck, guess the problem is the context [my888app] is not right. I already have the asterisk CLI in front of me
So, to recap:
No DID funny business, just SIP
In which .conf file do I put the [my888appp]
I dont understand if 888 is an entension or a channel
Multiple calls will be made at the same time to [my888app], is that a
problem?
Right now when I dial from the Phono app I get please enter the
channel number follow by the # sign, I dont know if that is helpful
or not
Thanks!!!

Well, after a lot of searching turns out the routing is as follows (default FreePBX installation):
The SIP calls goes into a context called from-sip-external
from there, it goes to the context from-trunk
from there it goes to from-pstn
from there it goes to ext-did-catchall
And there, in ext-did-catchall, is where I can put my888app and it will execute ok
I'm 100% positive this is not the correct place to put the app, but as I'm not an Asterisk expert I will settle for it.
Hope this help someone else.
Thanks.-

You need check the context attributes in your sip.conf. You can have a context in general section and you can have another in your peer definition, if you dont define any specific context in you peer then the general context attribute is assumed.
For simplicity I advice you change context in general section of sip.conf and put your my888app in extensions.conf.
Example of sip.conf general section:
[general]
context=my888app
...
About 888: it is a extension, an extension is a end point to your call. A channel is a object created dynamically when setting up a call to retain the session information and to exchange data (voice) between two points.

Answer is very simple, Any external call first land on the context which is defined under general section in sip.conf file. There you can define your own dial plan. if you want to redirect to your own context from there then you can use GoSub.

Related

Closing the server after receiving TCP request

I'm building a JMeter script in which I'm sending a TCP messages (both fixed length and variable length) to a server. The problem is the server doesn't sends anything at the end of the response message that may indicate that the response message is ended, resulting in the test run keeps on running and if I stop it manually it gives a 500 (Read Exception). I've by-passed this situation by adding a response time-out and a response assertion but when I load test my script all the requests fail. I've tried putting \n, \r, setting end of line to 10 etc but all in vain.
Now I've already gotten some opinions like it is due to server side settings but my question is what exactly are those settings about. Because I've to explain this blocker to non-tech persons. So is there any way that this issue can be overcome or can anyone please tell me what exactly are the server side settings that need to be configured.
If your requests fail then your Response Assertion doesn't really act like a "workaround", either you configured it not properly or you're receiving something which is not expected by the assertion.
We cannot help you efficiently without seeing:
Your Response Assertion configuration
TCP Sampler (or whatever Sampler you're using) response from the View Results Tree listener
At least few lines from hte .jtl results file containing results of your "load test"
If you want to mark all the Samplers as successful no matter of the real outcome you can use JSR223 Assertion with the following one-liner:
prev.setSuccessful(true)
Make sure to put it "high enough" so all the Samplers would be in the Assertion's scope
With regards to the "server-side-settings" which we're supposed to "tell" - we don't know that "server" you're trying to test so if it's something free and open source we need to know that piece of software name.
If it's something your colleagues developed in house - I'm afraid we're not able to help at all, you'd better ask them.

python3-pjsip(pjproject2.9 pjsua) custom sdp

I have a lab that I need to insert a custom body (SDP) in SIP message. I'm using python3-pjsip(pjproject2.9) to create simple SIP UA. However, python3-pjsip(pjproject2.9) does not support custom SDP. I found that someone raise a question about pjsua custom SDP on stack overflow and solved it. Unfortunately, I don't know how to modify the pjsua source with those tips. Would you tell me how to modify it in more detail or share the source you modified? .
Could I need to modify the C code?
I've never used PJSIP in Python, but I think you should look into on_call_sdp_created callback. There you should use pjmedia_sdp_media structure to add new SDP parameter to pjmedia_sdp_session provided by callback's argument. Functions pjmedia_sdp_attr_create and pjmedia_sdp_media_add_attr also should be helpful there.
Good luck!

Identify caller id, hung up, call back with asterisk

For a project I need to build an mvp of a service where users call a toll free number, on the other side, the pbx detects the call, saves the caller # and hangs up (so caller never gets charged for the call). Then the pbx calls the user back, allows him to dial a #, then pbx plays an audio file and when it finishes, makes the connection to the # introduced by the user.
I'm new to voip and asterisk, but which documentation should I read to achieve this (which features do I need to understand and look for?)
At begining you have to understand how to build dialplan and use it's applications(Dial, Playback and Read). If you want to use some programming language you can use AGI, there are library to write agi in almost all languages :)
For redialing user you can use call files or Asterisk Manager function originate. Call file can be used to call in future if you change creation time of file to future.
Simple flow can look like this:
User dial simple dialplan, run there some AGI, which read callerid and saves call file in near future. You do this without answering the call.
Call file dials user.
After answer you go to another dialplan which reads dtmf from user and dial that number.

how to get queue information from asterisk

I am running asterisk on a elastix 2.2 distro. I have a Queue with EXT 9000 where 3 softphone (c#) extensions belong to this round robin queue.
I know that I could trigger a AGI or AMI event from the dialplan and let in some way a webservice know about the length of the queue and then forward this information to the softphones.
Is there any way that the softphones could get this information directly from asterisk. Either something AsteriskBuiltIn or ElastixBuiltIn.
a last resort (baaaaaad) idea was to open a line, call an encoded number like (555*1) and receive back a dtmf. it is a Bad Way but it would work.
Open for any suggestions
Queue drop events into ami.
Also queue log all actions into /var/log/asterisk/queue_log, which is posible put to mysql(see this)
There are no way say how your softphone can catch that event. But for sure you can get that info from mysql and rewrite your softphones to show that info.
Also elastix call center edition have web panel for call center. As option you can check fop2 project for panel.

How to make asterisk server automatically response to SIP call?

My objective: I want to use softphone(3CX phone) register with asterisk server, and make call to the server and asterisk act
as a server to automatically response something, like play a song.
How i did: I installed asteriskNow using virtualbox, and registered the softphone by setting exntension for my SIP device
(extension 333). And i write a dialplan in etc/asterisk/extensions.conf. The dialplan is :
[incoming]
exten =>s,1,Answer()
exten =>s,n,Playback(dir-intro-oper)
exten =>s,n,Hangup()
I want any incoming call to server, the server will automatically answer, and play a pre-defined voice (dir-intro-oper.gsm )
then handup.
But I met the problem is:
I use softphone, and i dont know which number i should dial to the asterisk server. Should i set up a extension number for
asterisk server itself? If so, how to do that? By setting up SIP truck? Write the dialplan in sip.conf? or anything else?
Another questions:
I read the asterisk related book"asterisk, the future telephony" which tells us to write dialplan in the extensions.conf
directly, but i found the extensions.conf in the server which alerts us do not modified the file directly, must use web-gui
to modify.So which way i should follow?
In this case, i do not use any other hardware phone.
I am a novice on asterisk, please give me some hints and detail procedure.
The "s" extension that you are using is a "special" that when Asterisk doesn't know what to do, it tries to use that.
If you really want any call to the box, either from a VoIP phone or an ITSP to get handled the same way, try this:
[incoming]
exten =>_X.,1,Answer()
same => n,Playback(dir-intro-oper)
same => n,Hangup()
... and make sure that in your SIP phone and SIP trunk definitions that you set:
context=incoming
That literally forces all calls into your context and then no matter what you dial, you always match the extension number.
More reading at https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching
[incoming1]
exten => 333,1,Answer()
same => n,Playback(File_name)
same => n,Hangup()
Go to /etc/asterisk/extension_custom.conf and write your context like this:
and name the context as incoming1 or anything else cause incoming context already exists. I have named it as incoming1:
Now goto /etc/asterisk/sip_additional.conf and edit the context of extension you are going to register on the softphone.
Now register the softphone and you can dial the number 333 and everything will work properly.
![][3]