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
This commit is contained in:
Holger Hans Peter Freyther 2017-03-07 16:01:04 +01:00 committed by Holger Freyther
parent 63942320b3
commit 3d9ae085bf
1 changed files with 6 additions and 4 deletions

View File

@ -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;