kirm/sip.js — Issue #9: Error when sending INVITE via proxy
Author: c4live
Created: 2012-01-13 11:27:21+00:00
State: open

When Trying to use the proxy.js to forward an Invite request to another host, I get the following error:

/Users/me/javascript/node_modules/sip/proxy.js:7
var via = msg.headers.via[0];
^
TypeError: Cannot read property 'via' of undefined
at makeContextId (/Users/me/javascript/node_modules/sip/proxy.js:7:24)
at Object.send (/Users/me/javascript/node_modules/sip/proxy.js:18:22)
at /Users/me/javascript/e:109:8
at /Users/me/javascript/node_modules/sip/proxy.js:66:5
at next (/Users/me/javascript/node_modules/sip/:1121:15)
at /Users/me/javascript/node_modules/sip/:1138:7
at resolve (/Users/me/javascript/node_modules/sip/:796:12)
at Object.createClientTransaction (/Users/me/javascript/node_modules/sip/:1099:7)
at Object.send (/Users/me/javascript/node_modules/sip/:1204:30)
at forwardRequest (/Users/me/javascript/node_modules/sip/proxy.js:54:7)

Apparently the error is thrown in line 1113 of sip.js (I executed the code inside the debugger):

send.reliable = cn.local.protocol.toUpperCase() !== 'UDP';

From what I see, cn is an Object that does not have any 'local' property, so cn.local is undefined.
Therefore trying to access to cn.local.protocol results in a TypeError.