Routing of incoming calls by called number - asterisk

I have two phone numbers registered with the same sip provider. I would like Asterisk/PJSIP to route phone #1 (18005551212) differently than phone #2 (18005551313).
[sipprovider-18005551212]
type=registration
client_uri=sip:18005551212#sip.provider.com:5060
[sipprovider-18005551313]
type=registration
client_uri=sip:18005551313#sip.provider.com:5060
The Contact provided by Asterisk during registration is the same for both (using default extension 's').
Contact: <sip:s#10.1.1.1:5060>;expires=120
Can I do any of the following:
1) When registering, provide an extension other than 's'? Allowing inbound calls to hit unique extensions in the dialplan.
2) Route to unique context based on the To: Header on the INVITE? (which holds the unique phone number called). I have tried using 'context=' in the pjsip.conf endpoint block, but no luck; routing is either by IP (which is the same for both phone numbers), or by name (which is based on the From: Header).
Any help or pointers would be appreciated.

You could try this from my extensions.conf
[inbound-sip]
exten => 3215445,1,Goto(sip-in-1,s,1)
exten => 2544221,1,Goto(sip-in-2,s,1)
[sip-in-1]
exten => s,1,Goto(internal-ext,6881,1)
Calls then end up in the relevant context for further processing and alerting etc. sip-in-1 or sip-in-2 in this case.
In your sip.conf or pjsip.conf you need to specify the inbound context for both numbers you have - in this case context = inbound-sip

You should enable sip debug and see if calls have anything like destination number.
If it have no - you have no way get info which not present.
If you have, you should create extension s and parse number info using SIP_HEADER function from sip request body.

Related

MailMessage only accepts sender with #domain

I wrote a code in .NET to send emails in my application:
Oxygenne + ASP.Net:
mensagem:=MailMessage.Create(configemail[1],toUsers);
mensagem.Subject:=title;
mensagem.Body:=body;
mensagem.IsBodyHtml:=IsBodyHtml;
This works fine when configemail[1] is something like "myemail#gmail.com". However, I have the need to send emails without using domain, something like "myemail".
I am getting this error:
The specified string is not in the form required for an e-mail address
I believe this happens because the code validates if the variable has #anydomain in the string.
Am I able to override it, and let the user try to send emails without usind "#domain" in their address?
So far as I'm aware, SMTP requires all recipient mailboxes to have a domain part. You may be able to interact with a specific mail system via other protocols that allows you to interact with just local mailboxes but you shouldn't expect SMTP tools to be the means of doing so.
Per RFC 5321:
Only resolvable, fully-qualified domain names (FQDNs) are permitted
when domain names are used in SMTP ... There are two exceptions to the
rule requiring FQDNs
The reserved mailbox name "postmaster" may be used in a RCPT
command without domain qualification
Which in turn leads us to the syntax for the RCPT command:
rcpt = "RCPT TO:" ( "<Postmaster#" Domain ">" / "<Postmaster>" /
Forward-path ) [SP Rcpt-parameters] CRLF
So, the only generally applicable form that is available is the Forward-Path, which via a few hops (and ignoring some legacy options not helpful to you here) leads us to the Mailbox syntax:
Mailbox = Local-part "#" ( Domain / address-literal )
So, either way you have to have the # and then your choices boil down to a domain name or an IP address. Note that this may give us an opening though - you may be able to get what you want by specifying the addresses as myemail#127.0.0.1.

Asterisk pjsip outbound call From field

I'm trying to setup asterisk to make outbound calls via provider trunk. I'm using pjsip chan and FreeBPX ui. Incoming calls works, but outgoing produce SIP/2.0 403 Forbidden.
I examined pjsip history and found a problem - it is From field in invite packet. Provider wants From field as:
From: "792440XXXXX" <sip:792440XXXXX#multifon.ru>
but pjsip sends:
From: "Anonymous" <sip:792440XXXXX#multifon.ru>
I tried outbound route CID override and filled trunk/pjsip Settings/Advanced fields like "Contact user", "From Domain", "From user" but this didn't help.
What i'm doing wrong ?
From field in asterisk will be filled like this
From: "CALLERID(name)" <CALLERID(num)>
So you just have setup CALLERID(name) acordinly. Something like this
exten => _X.,n,Set(CALLERID(name)=${CALLERID(num)})

Change incoming sip uri from AsteriskNow to e.164 format

I write an IVR using UCMA, When I want to transfer the call I've got runtime error.
after searching I found that the problem is the uri of call from asterisk wich is in form of 1234 instead of +1234. How and where can i set incomming call uri in form of e.164? In lync setting? or in AsteriskNow.
I am using lync 2013, UCMA 4.0.
You can change callerid on outbound call by using something like that
exten => _x.,n,Set(CALLERID(num)=+${CALLERID(num)})
For asterisknow it maybe more complex, it is not doable via web so need see your configs.
After that call will come as +1234.

configuration spring MVc websocket messaging spring security

I customized the tutorial http://assets.spring.io/wp/WebSocketBlogPost.html into my application . When sending message from the application to the server using SimpMessageSendingOperations.convertAndSendToUser("fabrice","/stayawakews2/shakebaby", "mano") the log show :
/stayawakews2/shakebaby*-userltmei5cm* .I dont know why it add the value -userltmei5cm .
thanks
this is explained in the reference docs, see the section on user destinations and also these slides.
ltmei5cm - this is a websocket session id. This value generates on client side.
One logined user can have some websocket sessions.
For each webscocket connection(session) spring create individual queue.
If you send message to specific user, message will be added to some queues.
For this reason, the user name is replaced with the webcoket session id.
From JavaDoc comment to DefaultUserDestinationResolver.java:
When a user attempts to subscribe to "/user/queue/position-updates",
the "/user" prefix is removed and a unique suffix added, resulting in
something like "/queue/position-updates-useri9oqdfzo" where the suffix
is based on the user's session and ensures it does not collide with
any other users attempting to subscribe to
"/user/queue/position-updates". When a message is sent to a user
with a destination such as "/user/{username}/queue/position-updates",
the "/user/{username}" prefix is removed and the suffix added,
resulting in something like "/queue/position-updates-useri9oqdfzo".

Wildcards in an email address with qmail?

I'm trying to set up an email address in qmail such that a unique identifier can be passed as part of the email address.
For example:
reply-123#example.com, reply-345#example.com, reply-99999#example.com would all go to the 'reply' user and be sent to the same shell script. Currently, email sent to reply#example.com goes to the script and I pass the unique id in the subject or message body. Would be grateful for any suggestions. Thanks!
In a default qmail setup, you can do exactly what you suggest... anything following a dash is ignored for delivery purposes, so reply-anything#example.com will be processed by the .qmail-reply file, where you would presumably send the mail to your script and look at the address to obtain the identifier.
We use this for bounce tracking - if the email is to xyz#example.com, and the sender is bounce#sender.com, then the from address is written this way:
bounce-xyz=example.com#sender.com
And a script flags the address as no good.
EDIT:
I screwed this up a bit - I guess I'm rusty on qmail. The alias thing doesn't work by default as I stated above. To support extensions for bounce#sender.com, you need a .qmail-default file in ~bounce.
See the "extension addresses" (section 4.1.5) on LWQ: http://www.lifewithqmail.org/lwq.html

Resources