old args: const char * calledUser, const char * calledDomain, short rtpPort, Control::CodecSet codec,
| 588 | |
| 589 | //old args: const char * calledUser, const char * calledDomain, short rtpPort, Control::CodecSet codec, |
| 590 | void SipMOInviteClientTransactionLayer::MOCSendINVITE(const L3LogicalChannel *chan) |
| 591 | { |
| 592 | static const char* xmlGeoprivTemplate = |
| 593 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 594 | "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n" |
| 595 | "xmlns:gp=\"urn:ietf:params:xml:ns:pidf:geopriv10\"\n" |
| 596 | "xmlns:gml=\"urn:opengis:specification:gml:schema-xsd:feature:v3.0\"\n" |
| 597 | "entity=\"pres:%s@%s\">\n" |
| 598 | "<tuple id=\"1\">\n" |
| 599 | "<status>\n" |
| 600 | "<gp:geopriv>\n" |
| 601 | "<gp:location-info>\n" |
| 602 | "<gml:location>\n" |
| 603 | "<gml:Point gml:id=\"point1\" srsName=\"epsg:4326\">\n" |
| 604 | "<gml:coordinates>%s</gml:coordinates>\n" |
| 605 | "</gml:Point>\n" |
| 606 | "</gml:location>\n" |
| 607 | "</gp:location-info>\n" |
| 608 | "<gp:usage-rules>\n" |
| 609 | "<gp:retransmission-allowed>no</gp:retransmission-allowed>\n" |
| 610 | "</gp:usage-rules>\n" |
| 611 | "</gp:geopriv>\n" |
| 612 | "</status>\n" |
| 613 | "</tuple>\n" |
| 614 | "</presence>\n"; |
| 615 | |
| 616 | LOG(INFO) << "user " << sipLocalUsername() << " state " << getSipState() <<sbText(); |
| 617 | #if PAT_TEST_SIP_DIRECT |
| 618 | // (pat 7-23-2013): This code has eroded beyond recoverability... |
| 619 | //bool directBtsConnection = false; |
| 620 | // exten => _X.,1,Set(Name=${ODBC_SQL(select dial from dialdata_table where exten=\"${EXTEN}\")}) |
| 621 | // exten => _X.,n,GotoIf($["${Name}"=""] ?other-lines,${EXTEN},1) |
| 622 | // exten => _X.,n,Set(IPAddr=${ODBC_SQL(select ipaddr from sip_buddies where username=\"${Name}\")}) |
| 623 | // exten => _X.,n,GotoIf($["${IPAddr}"=""] ?other-lines,${EXTEN},1) |
| 624 | // exten => _X.,n,Set(Port=${ODBC_SQL(select port from sip_buddies where username=\"${Name}\")}) |
| 625 | // exten => _X.,n,GotoIf($["${Port}"!=""] ?dialNum) |
| 626 | // exten => _X.,n,Set(Port=5062) ; Port was not set, so set to default. Gets around bug in subscriberRegistry |
| 627 | // exten => _X.,n(dialNum),Dial(SIP/${Name}@${IPAddr}:${Port}) |
| 628 | if (gConfig.getStr("SIP.Proxy.Mode") == string("direct")) { |
| 629 | // Is this IMSI registered directly on a BTS? |
| 630 | string remoteIMSI = gSubscriberRegistry.getIMSI(wCalledUsername); |
| 631 | string remoteIPStr, remotePortStr; |
| 632 | if (remoteIMSI != "") { |
| 633 | remoteIPStr = gSubscriberRegistry.imsiGet(remoteIMSI,"ipaddr"); |
| 634 | remotePortStr = gSubscriberRegistry.imsiGet(remoteIMSI,"port"); |
| 635 | unsigned remotePort = (remotePortStr != "") ? atoi(remotePortStr.c_str()) : 0; |
| 636 | LOG(DEBUG) << "BTS direct test: "<<wCalledUsername |
| 637 | << format(" -> SIP/%s@%s:%s",remoteIMSI.c_str(),remoteIPStr.c_str(),remotePortStr.c_str()) <<sbText(); |
| 638 | if (remoteIPStr != "" && remotePort) { |
| 639 | //directBTSConnection = true; |
| 640 | mRemoteUsername = remoteIMSI; |
| 641 | mProxyIP = remoteIPStr; |
| 642 | mProxyPort = remotePort; |
| 643 | LOG(INFO) << "Calling BTS direct: "<<wCalledUsername |
| 644 | << format(" -> SIP/%s@%s:%u",mRemoteUsername.c_str(),mProxyIP.c_str(),mProxyPort) <<sbText(); |
| 645 | } |
| 646 | } |
| 647 | } |
no test coverage detected