All pastes #148503 Raw Edit

Mine

public text v1 · immutable
#148503 ·published 2006-08-25 06:00 UTC
rendered paste body
 {
        PString fullAddress;
        MyH323Connection * connection;
+       H323Transport *transport = NULL;

        /* Determine whether we are using a gatekeeper or not. */
        if (GetGatekeeper()) {
@@ -384,8 +404,23 @@
                if (h323debug) {
                        cout << " -- Making call to " << fullAddress << " without gatekeeper." << endl;
                }
+               /* Use bindaddr for outgoing calls too if we don't use gatekeeper */
+               if (listeners.GetSize() > 0) {
+                       H323TransportAddress taddr = listeners[0].GetTransportAddress();
+                       PIPSocket::Address addr;
+                       WORD port;
+                       if (taddr.GetIpAndPort(addr, port)) {
+                               cout << "Using " << addr << " for outbound call" << endl;
+                               transport = new H323TransportTCP(*this, addr);
+                               if (!transport) {
+                                       cout << "Unable to create transport for outgoing call" << endl;
+                               }
+                       } else {
+                               cout << "Unable to get address and port" << endl;
+                       }
+               }
        }
-       if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token, opts))) {
+       if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token, opts, transport))) {
                if (h323debug) {
                        cout << "Error making call to \"" << fullAddress << '"' << endl;
                }