Skip to content

Instantly share code, notes, and snippets.

@davehorton
Created March 23, 2015 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davehorton/24aa26518bd5e079863e to your computer and use it in GitHub Desktop.
Save davehorton/24aa26518bd5e079863e to your computer and use it in GitHub Desktop.
npm-debug.log when publish fails with 409
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'publish' ]
2 info using npm@2.2.0
3 info using node@v1.0.3
4 verbose node symlink /usr/local/bin/node
5 verbose publish [ '.' ]
6 silly cache add args [ '.', null ]
7 verbose cache add spec .
8 silly cache add parsed spec { raw: '.',
8 silly cache add scope: null,
8 silly cache add name: null,
8 silly cache add rawSpec: '.',
8 silly cache add spec: '/Users/dhorton/beachdog-enterprises/beachdog-networks/git/drachtio',
8 silly cache add type: 'directory' }
9 verbose addLocalDirectory /Users/dhorton/.npm/drachtio/0.1.0/package.tgz not in flight; packing
10 verbose tar pack [ '/Users/dhorton/.npm/drachtio/0.1.0/package.tgz',
10 verbose tar pack '/Users/dhorton/beachdog-enterprises/beachdog-networks/git/drachtio' ]
11 verbose tarball /Users/dhorton/.npm/drachtio/0.1.0/package.tgz
12 verbose folder /Users/dhorton/beachdog-enterprises/beachdog-networks/git/drachtio
13 info prepublish drachtio@0.1.0
14 verbose addLocalTarball adding from inside cache /Users/dhorton/.npm/drachtio/0.1.0/package.tgz
15 silly cache afterAdd drachtio@0.1.0
16 verbose afterAdd /Users/dhorton/.npm/drachtio/0.1.0/package/package.json not in flight; writing
17 verbose afterAdd /Users/dhorton/.npm/drachtio/0.1.0/package/package.json written
18 silly publish { name: 'drachtio',
18 silly publish version: '0.1.0',
18 silly publish description: 'Simple connect-style middleware for drachtio sip applications',
18 silly publish keywords: [ 'framework', 'sip', 'drachtio', 'middleware', 'connect' ],
18 silly publish dependencies:
18 silly publish { debug: '>= 0.7.3 < 1',
18 silly publish 'sip-status': '~0.1.0',
18 silly publish 'sip-methods': '~0.1.0',
18 silly publish delegates: '0.0.3',
18 silly publish 'utils-merge': '1.0.0' },
18 silly publish devDependencies:
18 silly publish { should: '>= 2.0.2 < 3',
18 silly publish mocha: '~2.1.0',
18 silly publish 'drachtio-client': '~0.1.0',
18 silly publish minimist: '^1.1.0',
18 silly publish merge: '^1.1.3',
18 silly publish async: '~0.9.0',
18 silly publish 'drachtio-test-fixtures': '~0.1.0' },
18 silly publish licenses: [ { type: 'MIT' } ],
18 silly publish main: './lib/connect',
18 silly publish engines: { node: '>= 0.8.0' },
18 silly publish repository:
18 silly publish { type: 'git',
18 silly publish url: 'https://github.com/davehorton/drachtio-connect.git' },
18 silly publish scripts: { test: 'make' },
18 silly publish readme: '# drachtio [![Build Status](https://secure.travis-ci.org/davehorton/drachtio.png)](http://travis-ci.org/davehorton/drachtio) [![NPM version](https://badge.fury.io/js/drachtio.svg)](http://badge.fury.io/js/drachtio)\n\n<!-- [![Gittip](http://img.shields.io/gittip/davehorton.png)](https://www.gittip.com/davehorton/)\n\n<sub><sup>All tips will go to support the good causes and great people of\n beautiful, rural Pembrokeshire, Wales, where this code was born. Iechyd da !!</sup></sub>\n-->\n\n[![drachtio logo](http://www.dracht.io/images/definition_only-cropped.png)](http://dracht.io/)\n\ndrachtio is [connect](https://github.com/senchalabs/connect)-inspired middleware for [SIP](https://www.ietf.org/rfc/rfc3261.txt) applications.\n\nIt is designed to make it easy for developers to incorporate SIP-based voice and data features into Node.js applications through the use of familiar middleware patterns. \n\ndrachtio enables developers to very easily build high-performance SIP proxy servers, registrars, user agents and other kinds of SIP applications on a Node.js stack.\n\n```js\n//simple SIP proxy\nvar drachtio = require(\'drachtio\');\nvar app = drachtio() ;\n\n//connect to a drachtio server\napp.connect({host:\'localhost\', port: 8022, secret: \'cymru\'}) ;\n\napp.invite( function( req, res ) {\n var user = req.msg.uri.match(/sip:(.*?)@(.*?)$/) ;\n\n //search for the user in 3 different locations\n req.proxy({\n destination: [\n \'sip:\' + user[1] + \'@site1.mycompany.com\',\n \'sip:\' + user[1] + \'@site2.mycompany.com\',\n \'sip:\' + user[1] + \'@site2.mycompany.com\'\n ],\n remainInDialog: true,\n forking: \'simultaneous\',\n headers: {\n \'Subject\': \'Incoming call for \' + user[1] \n }\n }, function(err, response){\n if( err ) return console.error(\'Error attempting to proxy request: \', err) ;\n console.log(\'Final response for proxy: \' + response.finalStatus ) ;\n }) ;\n}) ;\n```\n\nThe drachtio middleware framework does not itself contain a SIP stack - the network processing of SIP messages is performed by [drachtio-server](https://github.com/davehorton/drachtio-server), an instance of which must be running on a network-accessible server. drachtio-server is a high-performance, programmable SIP user agent written in C++ that is built on top of the open-source [sofia](https://github.com/davehorton/sofia-sip) SIP stack\n\ndrachtio also has a dependency on [drachtio-client](https://github.com/davehorton/drachtio-client), which is a Node.js library that manages a TCP connection to a drachtio server and provides SIP message parsing and other features. Commands to control the drachtio server are sent over this socket, and messages received and other events are transmitted back to the client. \n\n## Getting started\n### Creating an application\nThe first thing an application must do is to require the drachtio library and invoke the returned function to create an application. The application instance that is created is an EventEmitter.\n```js\nvar app = require(\'drachtio\')() ;\n```\n### Connecting to the server\nThe next thing an application must do is to call the \'connect\' method in order to connect to the drachtio-server that will be providing the SIP endpoint. By default, \ndrachtio-server listens for TCP connections from clients on port 8022. Clients must also provide a shared secret as a means of authentication. \n```js\napp.connect({\n host:\'localhost\', //ip address or DNS name of drachtio-server\n port: 8022, //defaults to 8022 if not provided\n secret: \'cymru\' //shared secret\n }, function( err, hostport ) {\n if( err ) throw err ;\n console.log(\'success! drachtio-server is listening on \' + hostport) ;\n}) ;\n```\n\nA \'connect\' event is emitted by the app object when the connection has been established; alternatively, a callback can be passed to the connect method, as shown above. \n\nThe callback or event handler will an error object (null in the case of a successful connection) and a string variable describing the sip address and port the drachtio server is listening on for SIP messages.\n\n### Receiving and responding to sip requests (UAS)\nA drachtio application can both send and receive SIP requests. To receive SIP requests (i.e to act as a User Agent Server), app[verb] methods are used. Request and Response objects are provided to the callback. \n\nThe Request object contains information describing the incoming sip request, along with methods that can be used to act on the request (e.g., req#proxy is a method provided to proxy the request). The Response object contains methods that allow the application to control the generation of the sip response, in the case of an application acting as a SIP user agent server (UAS). \n\n```js\napp.register( function( req, res ) {\n var contact = req.getParsedHeader(\'Contact\') ;\n var expires = contact.params.expires || req.get(\'Expires\') ;\n console.log(\'Received a REGISTER request with Expires value: \' + expires) ;\n\n res.send( 200, {\n headers: {\n \'Expires\': expires\n }\n })\n}) ;\n```\n> Notes:\n\n> + drachtio-server automatically sends a 100 Trying to all incoming INVITE messages, so a drachtio app does not need to do so.\n\n> + A \'Content-Length\' header is automatically provided by drachtio-server, so the application should not include that header.\n\n> + A \'Content-Type\' header of \'application/sdp\' will automatically be added by drachtio-server, where appropriate. When sending any other content types, an application must explicitly include a \'Content-Type\' header.\n\n> + Request and Response objects both support a `get` method to return the value of a named SIP header as a string value, and `getParsedHeader` to return object that represents the SIP header parsed into its component values.\n\n\n#### res#send\nThe `res.send` method can take up to four arguments: `(code, reason, opts, callback)`:\n- `code` is the only required parameter and is the numeric SIP response value.\n- `reason` is a custom status text value that will appear in the SIP response line; if not provided the well-known reason that is associated with the provided code will be used.\n- `opts` is a javascript object containing values that control the generation of the response; most notably a `body` property which provides a value for the body of the SIP response and a `headers` property which provides one or more SIP headers that will be populated in the response.\n- `callback` is a function that will be called once the SIP response message has actually been sent. The callback will receive two arguments: `(err, response)`; the `err` value is an object describing an error (if any) that drachtio-server encountered in generating the SIP response, and the response object is a representation of the actual message that was sent over the wire. \n\n> Note:\n> Most of the standard SIP headers in the response will be populated automatically by the drachtio server based on the associated request. It is only necessary to populate those additional headers that you want to be carried in the response which the drachtio server would not know to populate.\n\n```js\napp.invite( function( req, res ) {\n res.send(480, \'Database down\', {\n headers: {\n \'Retry-After\': "1800 (scheduled maintenance)"\n }\n }) ;\n}) ;\n```\n### Sending sip requests (UAC)\n\nSIP requests can be sent (i.e., to act as a User Agent Client) using the app.request method:\n\n```js\n// connect and then send an OPTIONS ping\napp.connect({host:\'localhost\',port: 8022,secret: \'cymru\'},\n function(err, hostport){\n if( err ) throw err ;\n\n //connected ok\n app.request({\n uri: \'sip:1234@10.168.12.139\'.\n method: \'OPTION\',\n headers: {\n \'User-Agent\': \'dracht.io\'\n }\n } function( err, req ) {\n if( err ) console.error( err ) ;\n\n req.on(\'response\', function(response){\n console.log(\'response status was \' + response.status) ;\n app.disconnect() ;\n }) ;\n }) ; \n }\n);\n```\n> Note: as in the above example, an application can only call `app#send` after connecting to drachtio-server. An attempt to send a request before a connection to the server has been established will result in an error being thrown.\n\n#### app#request\nThe callback receives the arguments `(err, req)`, where `error` represents the error encountered (if any) attempting to send the request, and the `req` object represents the message that was actually sent over the wire. \n\nThe `req` object provided to the callback is an EventEmitter, and in order to receive responses to the request an application must listen for the `response` event, as shown in the example above. The `response` event will be emitted with a paramater that describes the response(s) that were received from the network for the request.\n\n#### Generating an ACK request\nAn ACK is a special case request; it is required to be sent after receiving a final response to an INVITE request. In the case of sending an INVITE, the `response` event for a final response that is received for that INVITE will be passed a second parameter after the response message itself -- this parameter is a function that can be called to generate the ACK request for the INVITE.\n\n````\napp.request({\n uri: myUri,\n method: \'INVITE\',\n body: mySdp\n}, function( err, req ) {\n if( err ) throw err ;\n req.on(\'response\', function(res, ack){\n if( res.status >= 200 ) ack() ;\n }) ;\n}) ;\n\n````\n\n> Note:\n> Strictly speaking, it is not necessary to generate the ACK for a non-success final response, because the drachtio server SIP stack does this automatically. However, there is no harm in calling the `ack()` method in this scenario. Note that the application *must* call `ack()` in the case of a 200 OK response to an INVITE.\n\n#### Canceling a request\n\nTo cancel a sip INVITE that has been sent by the application, an application may use the `cancel` method on the request object that is returned in the callback to `app#request`.\n\n```js\napp.request({\n uri: \'sip:1234@192.168.173.139\',\n method: \'INVITE\',\n body: config.sdp\n}, function( err, req ) {\n if( err ) throw err ;\n req.on(\'response\', function(response, ack){\n if( response.status >= 200 ) ack() ;\n }) ;\n\n //generate cancel after 2 seconds\n setTimeout( function() { \n req.cancel() ;\n }, 2000) ;\n}) ;\n```\n\n#### Reliable provisional responses\n\nResponding to a SIP INVITE with a reliable provisional response is easy: just add a `Require: 100rel` header to the INVITE request and drachtio-server will handle that for you. However, after sending a response reliably, your app should wait for the PRACK to be received before sending the final response. \n\n```js\nvar inviteRes ;\napp.invite(function(req, res) {\n inviteRes = res ;\n res.send( 183,{\n headers: {\n require: \'100rel\',\n supported: \'100rel\'\n },\n body: mySdp\n }) ;\n}) ;\n\napp.prack( function(req, res){\n res.send(200) ;\n inviteRes.send( 200, {\n body: mySdp\n }); \n}) ;\n```\n\n> Note that if you want to use reliable provisional responses if the remote side supports them, but establish the call without them if the remote side does not support it, then include a `Supported` header but do not include a `Require` header.\n\nSimiliarly, if you want to send reliable provisional responses, just add a `Require: 100rel` header in your response, and drachtio-server will handle sending reliable provisional response for you. \n\n### SIP Proxy\nCreating a sip proxy application is easy: simply call `req#proxy` on the incoming request object with an object parameter that provides instructions to drachtio server on how you want the proxy operation carried out. The `proxy` function takes two parameters `(opts, callback`) as described below:\n\n```js\nopts:\n - destination: [String|Array] one more sip uris (required) \n - remainInDialog: [boolean] if true, insert a Record-Route header \n (default: false)\n - followRedirects: [boolean] if true, generate new INVITEs in \n response to 3XX responses; \n if false, forward 3xx responses upstream\n back to the originating client (default: false)\n - wantsFullResponse: [boolean] if true, pass full detail\n on all responses received in callback; \n if false, simply invoke callback with no\n response information once the request(s)\n have been forwarded (default: false)\n - headers: [Object] SIP headers to add to the forwarded request\n - forking: [String] if \'simultaneous\' then requests are forwarded\n simultaneously to all provided destinations\n (assuming that multiple destinations were provided);\n otherwise requests are forwarded serially, \n attempting each destination in turn until\n a final success response is received or the \n list of destinations is exhausted (default: serial)\n\n\ncallback( err, response )\n - err: an Error object describing the error, if any, that occurred when \n drachtio server attempted to proxy the request\n - response: an object, only provided when the \'wantsFullResponse\' \n parameter was set to true. The response object\n contains full details on all of the final responses\n received from the forwarded request.\n```\nAn example of the response data provided to the response parameter in the `req#proxy` callback for the case where a single destination was provided and the far end responded with a non-success 404 Not Found response can be found [here](https://gist.github.com/davehorton/040f2b4eceb782e92ea2).\n',
18 silly publish readmeFilename: 'Readme.md',
18 silly publish gitHead: '4ffe8902b7541923c0fd7943b1702d2d2d941944',
18 silly publish bugs: { url: 'https://github.com/davehorton/drachtio-connect/issues' },
18 silly publish homepage: 'https://github.com/davehorton/drachtio-connect',
18 silly publish _id: 'drachtio@0.1.0',
18 silly publish _shasum: '7a7a94bb7df67e8934ebde8a48ea0dce3430b16d',
18 silly publish _from: '.' }
19 silly mapToRegistry name drachtio
20 silly mapToRegistry using default registry
21 silly mapToRegistry registry https://registry.npmjs.org/
22 silly mapToRegistry uri https://registry.npmjs.org/drachtio
23 verbose publish registryBase https://registry.npmjs.org/
24 silly publish uploading /Users/dhorton/.npm/drachtio/0.1.0/package.tgz
25 verbose request uri https://registry.npmjs.org/drachtio
26 verbose request sending authorization for write operation
27 info attempt registry request try #1 at 16:19:08
28 verbose request id f8123b081bfc2100
29 http request PUT https://registry.npmjs.org/drachtio
30 http 409 https://registry.npmjs.org/drachtio
31 verbose headers { date: 'Mon, 23 Mar 2015 23:19:11 GMT',
31 verbose headers server: 'Apache',
31 verbose headers 'content-type': 'application/json',
31 verbose headers 'cache-control': 'max-age=60',
31 verbose headers 'content-length': '17',
31 verbose headers 'accept-ranges': 'bytes',
31 verbose headers via: '1.1 varnish',
31 verbose headers 'x-served-by': 'cache-sjc3123-SJC',
31 verbose headers 'x-cache': 'MISS',
31 verbose headers 'x-cache-hits': '0',
31 verbose headers 'x-timer': 'S1427152749.134152,VS0,VE1985',
31 verbose headers connection: 'close' }
32 verbose request invalidating /Users/dhorton/.npm/registry.npmjs.org/drachtio on PUT
33 verbose request uri https://registry.npmjs.org/drachtio?write=true
34 verbose request no auth needed
35 info attempt registry request try #1 at 16:19:11
36 http request GET https://registry.npmjs.org/drachtio?write=true
37 http 200 https://registry.npmjs.org/drachtio?write=true
38 verbose request uri https://registry.npmjs.org/drachtio
39 verbose request sending authorization for write operation
40 info attempt registry request try #1 at 16:19:12
41 http request PUT https://registry.npmjs.org/drachtio
42 http 409 https://registry.npmjs.org/drachtio
43 verbose headers { date: 'Mon, 23 Mar 2015 23:19:12 GMT',
43 verbose headers server: 'Apache',
43 verbose headers 'content-type': 'application/json',
43 verbose headers 'cache-control': 'max-age=60',
43 verbose headers 'content-length': '17',
43 verbose headers 'accept-ranges': 'bytes',
43 verbose headers via: '1.1 varnish',
43 verbose headers 'x-served-by': 'cache-sjc3129-SJC',
43 verbose headers 'x-cache': 'MISS',
43 verbose headers 'x-cache-hits': '0',
43 verbose headers 'x-timer': 'S1427152752.460704,VS0,VE316',
43 verbose headers connection: 'close' }
44 verbose request invalidating /Users/dhorton/.npm/registry.npmjs.org/drachtio on PUT
45 verbose stack Error: Registry returned 409 for PUT on https://registry.npmjs.org/drachtio
45 verbose stack at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:234:14)
45 verbose stack at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:172:14)
45 verbose stack at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:373:22)
45 verbose stack at Request.emit (events.js:98:17)
45 verbose stack at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1318:14)
45 verbose stack at Request.emit (events.js:117:20)
45 verbose stack at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1266:12)
45 verbose stack at IncomingMessage.emit (events.js:117:20)
45 verbose stack at _stream_readable.js:888:16
45 verbose stack at process._tickCallback (node.js:337:11)
46 verbose statusCode 409
47 verbose pkgid drachtio
48 verbose cwd /Users/dhorton/beachdog-enterprises/beachdog-networks/git/drachtio
49 error Darwin 14.1.0
50 error argv "node" "/usr/local/bin/npm" "publish"
51 error node v1.0.3
52 error npm v2.2.0
53 error code E409
54 error Registry returned 409 for PUT on https://registry.npmjs.org/drachtio
55 error If you need help, you may report this error at:
55 error <http://github.com/npm/npm/issues>
56 verbose exit [ 1, true ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment