I am trying to make an outbound call from a standalone UCMA application to a SIP provider (Gamma) which authenticates based on connecting IP address. Here is the code with which I am trying to achieve this (lifted straight from Michael Greenlee (http://blog.greenl.ee/2012/06/15/outbound-calls-ucma-lync-server/):
ApplicationEndpointSettings endpointSettings =
new ApplicationEndpointSettings("sip:02037571***@80.229.80.***"); // My Ext. IP
...
CallEstablishOptions options = new CallEstablishOptions();
options.ConnectionContext = new ConnectionContext("88.215.61.***", 5060); // Gamma Ext. IP
Conversation conv = new Conversation(_endpoint);
AudioVideoCall avcall = new AudioVideoCall(conv);
avcall.BeginEstablish("sip:07709411***@88.215.61.***", options,
ar2 =>
{
try
{
avcall.EndEstablish(ar2);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
},
null);
The attempt to dial fails with Gamma returning a 403 Forbidden-Source Endpoint Lookup Failed.
I have compared wireshark traces with this failed attempt, and that of a hardware PBX which can dial out successfully.
Working hardware PBX:
From: "02037571***"<sip:02037571***@80.229.80.***>;tag=39E432463135364100006C30
SIP Display info: "02037571***"
SIP from address: sip:[email protected].***
SIP from address User Part: 02037571***
SIP from address Host Part: 80.229.80.***
SIP from tag: 39E432463135364100006C30
To: <sip:[email protected].***:5060>
SIP to address: sip:[email protected].***:5060
SIP to address User Part: 07709411***
SIP to address Host Part: 88.215.61.***
SIP to address Host Port: 5060
Contact: <sip:[email protected].***:5060>
Contact URI: sip:[email protected].***:5060
Contact URI User Part: 02037571***
Contact URI Host Part: 80.229.80.***
Contact URI Host Port: 5060
Failing UCMA Application:
FROM: ""<sip:02037571***@80.229.80.***>;epid=C18B8F5C05;tag=be8d09ca4
SIP Display info: ""
SIP from address: sip:02037571***@80.229.80.***
SIP from address User Part: 02037571***
SIP from address Host Part: 80.229.80.***
SIP from tag: be8d09ca4
TO: <sip:[email protected].***:5060>
SIP to address: sip:[email protected].***:5060
SIP to address User Part: 07709411***
SIP to address Host Part: 88.215.61.***
SIP to address Host Port: 5060
CONTACT: <sip:ADRIANHAND49F2.UnifyBusiness.local:5060;transport=Tcp;maddr=172.32.42.62;ms-opaque=260fcc58fdb93b58>;automata;actor="attendant";text;audio;video;image
Contact URI: sip:ADRIANHAND49F2.UnifyBusiness.local:5060;transport=Tcp;maddr=172.32.42.62;ms-opaque=260fcc58fdb93b58
Contact URI Host Part: ADRIANHAND49F2.UnifyBusiness.local
Contact URI Host Port: 5060
Contact URI parameter: transport=Tcp
Contact URI parameter: maddr=172.32.42.62
Contact URI parameter: ms-opaque=260fcc58fdb93b58
As you can see, the FROM and TO portions are largely similar, but the CONTACT portion contains the particulars of my machine and domain rather than those I specified as the Application Endpoint, as well as the LAN IP of my machine (maddr=172.32.42.62).
If I debug and inspect _endpoint, the EndpointUri property contains the ADRIANHAND49F2.UnifyBusiness.local string which I believe is the reason Gamma is rejecting my attempt to make a call. This property is readonly so I am a little bit stuck - can anybody help me connect to my SIP provider, please? All thoughts gratefully received, thank you!
The contact address is coming from the ServerPlatformSettings parameters (localhost / port).
If you change the localhost parameter to a dotted address (or name that makes more sense to you), that should work for you, I hope.
What I don't know is how to set a user of the contact URI, but I'm not sure that matters.