I’m making a Winforms dial call app using SIPSorcery library to make and accept call from accounts registered on my company’s OpenScape server. The server is tested with Zoiper call app and those accounts work fine on Zoiper, so I use Zoiper to test my app too. Now I can make my app to login and accept call from the accounts registered in Zoiper but I can’t make a call back with my app. Here is my code:
private async Task MakeCall()
{
try
{
string destUri = $”sip:{Username2}@{Domain}:{Port}”;
var winAudioEndPoint = new WindowsAudioEndPoint(new AudioEncoder());
winAudioEndPoint.RestrictFormats(x => x.Codec == AudioCodecsEnum.PCMU);
var voipMediaSession = new VoIPMediaSession(winAudioEndPoint.ToMediaEndPoints());
voipMediaSession.AcceptRtpFromAny = true;
SIPCallDescriptor callDescriptor = new SIPCallDescriptor(
username: Username1,
password: Password,
uri: destUri,
from: $"sip:{Username}@{Domain}:{Port}",
to: destUri,
routeSet: null,
customHeaders: new List<string>
{
"User-Agent: CustomClient"
},
authUsername: Username,
callDirection: SIPCallDirection.Out,
contentType: SDP.SDP_MIME_CONTENTTYPE,
content: null,
mangleIPAddress: null
);
bool callResult = await _sipUserAgent.Call(callDescriptor, voipMediaSession, 15);
if (callResult)
{
AddToListBox("Call initiated.");
}
else
{
AddToListBox("Call failed to connect.");
}
}
catch (Exception ex)
{
AddToListBox($"Error making call: {ex.Message}");
}
}