@babblevoice/babble-drachtio-callmanager 1.5.3 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/call.js CHANGED
@@ -2344,6 +2344,9 @@ class call {
2344
2344
  @param { string } [ options.entity.realm ]
2345
2345
  @param { string } [ options.entity.uri ]
2346
2346
  @param { number } [ options.entity.max ] - if included no more than this number of calls for this entity (only if we look user up)
2347
+ @param { object } [ options.callerid ]
2348
+ @param { string } [ options.callerid.number ]
2349
+ @param { string } [ options.callerid.name ]
2347
2350
  @param { object } [ callbacks ]
2348
2351
  @param { earlycallback } [ callbacks.early ] - callback to provide a call object with early call (pre dialog)
2349
2352
  @param { confirmcallback } [ callbacks.confirm ] - called when a dialog is confirmed but before it is bridged with a parent - this provides an opportunity for another call to adopt this call
@@ -2454,6 +2457,17 @@ class call {
2454
2457
  }
2455
2458
  }
2456
2459
 
2460
+ /* oveide caller id */
2461
+ if( options.callerid ) {
2462
+ if( options.callerid.number ) {
2463
+ user = options.callerid.number
2464
+ }
2465
+
2466
+ if( options.callerid.name ) {
2467
+ name = options.callerid.name
2468
+ }
2469
+ }
2470
+
2457
2471
  let callerid = `"${name}" <sip:${user}@${realm}>`
2458
2472
 
2459
2473
  newcall.options.headers[ "Remote-Party-ID" ] = callerid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1100,4 +1100,44 @@ describe( "call object", function() {
1100
1100
  c._onhangup( "wire" )
1101
1101
 
1102
1102
  } )
1103
+
1104
+ it( `overide caller id name`, async function() {
1105
+ new srf.srfscenario( {} )
1106
+
1107
+ let options = {
1108
+ "contact": "ourcontactstring",
1109
+ "callerid": {
1110
+ "name": "Hello"
1111
+ }
1112
+ }
1113
+
1114
+ let c = await call.newuac( options )
1115
+
1116
+ /* no default configured */
1117
+ expect( c.options.headers[ "Remote-Party-ID" ] ).to.equal( '"Hello" <sip:0000000000@localhost.localdomain>' )
1118
+
1119
+ c._onhangup( "wire" )
1120
+
1121
+ } )
1122
+
1123
+
1124
+ it( `overide caller id number`, async function() {
1125
+ new srf.srfscenario( {} )
1126
+
1127
+ let options = {
1128
+ "contact": "ourcontactstring",
1129
+ "callerid": {
1130
+ "number": "012345789"
1131
+ }
1132
+ }
1133
+
1134
+ let c = await call.newuac( options )
1135
+
1136
+
1137
+ /* no default configured */
1138
+ expect( c.options.headers[ "Remote-Party-ID" ] ).to.equal( '"" <sip:012345789@localhost.localdomain>' )
1139
+
1140
+ c._onhangup( "wire" )
1141
+
1142
+ } )
1103
1143
  } )