From 3d9ae085bf498c24a5c338e80929369ba9f851d1 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 7 Mar 2017 16:01:04 +0100 Subject: [PATCH] sip: Actually honor the remote port of the pbx So far the remote_port has never been used. sofia-sip did the right thing and put the port into the "Contact" and the rport option for the via. But we would have never been able to connect a PBX on a different port (as sofia-sip seems to parse the destination from the to address). Change-Id: Ifbd49b4aa6b01b118fe67e39dddef50b2946159c --- src/sip.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sip.c b/src/sip.c index afff393..348f478 100644 --- a/src/sip.c +++ b/src/sip.c @@ -293,12 +293,14 @@ static int send_invite(struct sip_agent *agent, struct sip_call_leg *leg, { struct call_leg *other = leg->base.call->initial; - char *from = talloc_asprintf(leg, "sip:%s@%s", + char *from = talloc_asprintf(leg, "sip:%s@%s:%d", calling_num, - agent->app->sip.local_addr); - char *to = talloc_asprintf(leg, "sip:%s@%s", + agent->app->sip.local_addr, + agent->app->sip.local_port); + char *to = talloc_asprintf(leg, "sip:%s@%s:%d", called_num, - agent->app->sip.remote_addr); + agent->app->sip.remote_addr, + agent->app->sip.remote_port); char *sdp = sdp_create_file(leg, other); leg->state = SIP_CC_INITIAL;