Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Roger Burton West
On Sun, Dec 19, 2010 at 12:14:11AM -0500, Stephen Reese wrote:

Thanks for the heads up, I have been setting the caller-ID but the
trouble I'm running into is specifying the which number to call out
as. How can an extension specify a different number? See below for my
current extension.conf, thanks.

I think I'd probably replace the two outgoing contexts with one, using a
GotoIf to distinguish between the two phones (branching into your
current code).

Alternatively you could give them each a custom context (say phone1 and
phone2); phone1 would include incoming and outgoing1, phone2 would
include incoming and outgoing2.


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Jeroen Eeuwes
Hi Stephen,

 Thanks for the heads up, I have been setting the caller-ID but the
 trouble I'm running into is specifying the which number to call out
 as. How can an extension specify a different number? See below for my
 current extension.conf, thanks.

You can check the channel-name to see which extension is making the
call and set the CallerID accordingly. The channel-name will be
something like SIP/201-abc23ef34 or SIP/User1-def34abc51. The 201
or User1 part depends on how you put the username in sip.conf  You can
use the CUT function to get the calling extension and then jump to the
correct CallerID. I've used something like this:

[outgoing]
exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
exten = _1NXXNXX,n,GotoIf($[${Outgoing} = User2]?20:10)
exten = _1NXXNXX,10,Set(CALLERID(num)=3012323434)
exten = _1NXXNXX,n,Set(CALLERID(name)=User1)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
exten = _1NXXNXX,n,Goto(h,1)
exten = _1NXXNXX,20,Set(CALLERID(num)=3013232322)
exten = _1NXXNXX,n,Set(CALLERID(name)=User2)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
exten = _1NXXNXX,n,Goto(h,1)

But in my case I had two different domains. E.g.
Dial(SIP/${ext...@provider-id1) and Dial(SIP/${ext...@provider-id2)
instead of setting the CallerID.

Not that the Cut doesn't work correctly if you use a minus-sign in the username.

Best regards,
Jeroen Eeuwes

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Stephen Reese
 You can check the channel-name to see which extension is making the
 call and set the CallerID accordingly. The channel-name will be
 something like SIP/201-abc23ef34 or SIP/User1-def34abc51. The 201
 or User1 part depends on how you put the username in sip.conf  You can
 use the CUT function to get the calling extension and then jump to the
 correct CallerID. I've used something like this:

 [outgoing]
 exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
 exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
 exten = _1NXXNXX,n,GotoIf($[${Outgoing} = User2]?20:10)
 exten = _1NXXNXX,10,Set(CALLERID(num)=3012323434)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User1)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)
 exten = _1NXXNXX,20,Set(CALLERID(num)=3013232322)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User2)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)

 But in my case I had two different domains. E.g.
 Dial(SIP/${ext...@provider-id1) and Dial(SIP/${ext...@provider-id2)
 instead of setting the CallerID.

 Not that the Cut doesn't work correctly if you use a minus-sign in the 
 username.

 Best regards,
 Jeroen Eeuwes

Thanks Jeroen, though it is still not firing correct, I have provided
a little more information.

Here are the channel-names:

SIP/201-000a

SIP/101-0012

Here is the extension information from the sip.conf:

[101]
type=friend
username=101
secret=
mailbox=101
callerid=User One 101
host=dynamic
nat=yes
dtmfmode=rfc2833
canreinvite=no
reinvite=no
qualify=yes

[201]
type=friend
username=201
secret=
mailbox=201
callerid=User Two 201
host=dynamic
nat=yes
dtmfmode=rfc2833
canreinvite=no
reinvite=no
qualify=yes

Here is the updated outgoing context that you provided with a few updates.

[outgoing]
exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
exten = _1NXXNXX,n,GotoIf($[${Outgoing} = User Two]?20:10)
exten = _1NXXNXX,10,Set(CALLERID(num)=3012323434)
exten = _1NXXNXX,n,Set(CALLERID(name)=User One)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
exten = _1NXXNXX,n,Goto(h,1)
exten = _1NXXNXX,20,Set(CALLERID(num)=3013232322)
exten = _1NXXNXX,n,Set(CALLERID(name)=User Two)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
exten = _1NXXNXX,n,Goto(h,1)

Based on the information above, what should be altered to correctly
associated the number with the relevant extension?

Thanks

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread William Stillwell


-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Stephen Reese
Sent: Sunday, December 19, 2010 12:49 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Specifying DID for outbound calls

 You can check the channel-name to see which extension is making the
 call and set the CallerID accordingly. The channel-name will be
 something like SIP/201-abc23ef34 or SIP/User1-def34abc51. The 201
 or User1 part depends on how you put the username in sip.conf  You can
 use the CUT function to get the calling extension and then jump to the
 correct CallerID. I've used something like this:

 [outgoing]
 exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
 exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
 exten = _1NXXNXX,n,GotoIf($[${Outgoing} = User2]?20:10)
 exten = _1NXXNXX,10,Set(CALLERID(num)=3012323434)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User1)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)
 exten = _1NXXNXX,20,Set(CALLERID(num)=3013232322)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User2)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)

 But in my case I had two different domains. E.g.
 Dial(SIP/${ext...@provider-id1) and Dial(SIP/${ext...@provider-id2)
 instead of setting the CallerID.

 Not that the Cut doesn't work correctly if you use a minus-sign in the
username.

 Best regards,
 Jeroen Eeuwes

Thanks Jeroen, though it is still not firing correct, I have provided
a little more information.

Here are the channel-names:

SIP/201-000a

SIP/101-0012

Here is the extension information from the sip.conf:

[101]
type=friend
username=101
secret=
mailbox=101
callerid=User One 101
host=dynamic
nat=yes
dtmfmode=rfc2833
canreinvite=no
reinvite=no
qualify=yes

[201]
type=friend
username=201
secret=
mailbox=201
callerid=User Two 201
host=dynamic
nat=yes
dtmfmode=rfc2833
canreinvite=no
reinvite=no
qualify=yes

Here is the updated outgoing context that you provided with a few updates.

[outgoing]
exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
exten = _1NXXNXX,n,GotoIf($[${Outgoing} = User Two]?20:10)
exten = _1NXXNXX,10,Set(CALLERID(num)=3012323434)
exten = _1NXXNXX,n,Set(CALLERID(name)=User One)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
exten = _1NXXNXX,n,Goto(h,1)
exten = _1NXXNXX,20,Set(CALLERID(num)=3013232322)
exten = _1NXXNXX,n,Set(CALLERID(name)=User Two)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
exten = _1NXXNXX,n,Goto(h,1)

Based on the information above, what should be altered to correctly
associated the number with the relevant extension?

Thanks


You can also just use an agi script to look up their current caller-id in a
database, and set it to the correct caller-id needed.

exten = _NXXNXX,1,AGI(getcid.pl,${CALLERID(NUM)},1)
exten = _NXXNXX,n,Dial(SIP/+1${ext...@providerx,60)
exten = _NXXNXX,n,congestion()

my getcid.pl expects two values, extension callerid, and a type.

911 gets 0, inhouse gets 1, outside 2 etc. (as I ust the getcid for
different Dial() options.

The script then looks up there station callerid, and set it to an
apporiate value, 911 always gets local in house direct number, regular stuff
gets a toll number, inhouse gets there extension number, and if there
callerid is not found in the database it returns a 'default' value.

This way every user can have multiple caller id's .





--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread sean darcy
On Sun, Dec 19, 2010 at 1:52 PM, William Stillwell
will...@stillwellsoft.com wrote:


 -Original Message-
 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Stephen Reese
 Sent: Sunday, December 19, 2010 12:49 PM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] Specifying DID for outbound calls

 You can check the channel-name to see which extension is making the
 call and set the CallerID accordingly. The channel-name will be
 something like SIP/201-abc23ef34 or SIP/User1-def34abc51. The 201
 or User1 part depends on how you put the username in sip.conf  You can
 use the CUT function to get the calling extension and then jump to the
 correct CallerID. I've used something like this:

 [outgoing]
 exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
 exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
 exten = _1NXXNXX,n,GotoIf($[${Outgoing} = User2]?20:10)
 exten = _1NXXNXX,10,Set(CALLERID(num)=3012323434)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User1)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)
 exten = _1NXXNXX,20,Set(CALLERID(num)=3013232322)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User2)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)

 But in my case I had two different domains. E.g.
 Dial(SIP/${ext...@provider-id1) and Dial(SIP/${ext...@provider-id2)
 instead of setting the CallerID.

 Not that the Cut doesn't work correctly if you use a minus-sign in the
 username.

 Best regards,
 Jeroen Eeuwes

 Thanks Jeroen, though it is still not firing correct, I have provided
 a little more information.

 Here are the channel-names:

 SIP/201-000a

 SIP/101-0012

 Here is the extension information from the sip.conf:

 [101]
 type=friend
 username=101
 secret=
 mailbox=101
 callerid=User One 101
 host=dynamic
 nat=yes
 dtmfmode=rfc2833
 canreinvite=no
 reinvite=no
 qualify=yes

 [201]
 type=friend
 username=201
 secret=
 mailbox=201
 callerid=User Two 201
 host=dynamic
 nat=yes
 dtmfmode=rfc2833
 canreinvite=no
 reinvite=no
 qualify=yes

 Here is the updated outgoing context that you provided with a few updates.

 [outgoing]
 exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
 exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
 exten = _1NXXNXX,n,GotoIf($[${Outgoing} = User Two]?20:10)
 exten = _1NXXNXX,10,Set(CALLERID(num)=3012323434)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User One)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)
 exten = _1NXXNXX,20,Set(CALLERID(num)=3013232322)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User Two)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)

 Based on the information above, what should be altered to correctly
 associated the number with the relevant extension?

 Thanks


 You can also just use an agi script to look up their current caller-id in a
 database, and set it to the correct caller-id needed.

 exten = _NXXNXX,1,AGI(getcid.pl,${CALLERID(NUM)},1)
 exten = _NXXNXX,n,Dial(SIP/+1${ext...@providerx,60)
 exten = _NXXNXX,n,congestion()

 my getcid.pl expects two values, extension callerid, and a type.

 911 gets 0, inhouse gets 1, outside 2 etc. (as I ust the getcid for
 different Dial() options.

 The script then looks up there station callerid, and set it to an
 apporiate value, 911 always gets local in house direct number, regular stuff
 gets a toll number, inhouse gets there extension number, and if there
 callerid is not found in the database it returns a 'default' value.

 This way every user can have multiple caller id's .





 --
 _
 -- Bandwidth and Colocation Provided by http://www.api-digital.com --
 New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


You're setting a callerid in sip.conf, so in extensions.conf why not:
if callerid(num) = 201, set callerid(num) = 3012323434 (or whatever)?

sean

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Joshua Colp
- Original Message -
 The host I am working with has two accounts from the same DID
 provider. Incoming calls work correctly and dial the appropriate
 extensions. This also allows incoming calls to be billed appropriately
 to the
 individual DID accounts.
 
 Outgoing calls from either extension default to the first DID, i.e.
 calls from either extension have the same callerID. How can an
 extension specify separate outgoing contexts so the correct number is
 associated with it, also allowing the SIP provider to recognize the
 difference for billing purposes, or is there a better way?
 
 In short I'm looking to associate an outgoing call from an extension
 with a specific number.
 
 Here's the sip.conf for both accounts as they are using IP routing,
 I'm assuming I do not have to perform auth based to separate the two
 accounts for outgoing calls:

I'm surprised nobody has suggested using the setvar functionality. It's 
extremely
useful for stuff like this and would allow you to keep all CallerID information
with the actual configuration of the device.

Using a configuration entry for sip.conf in another response as an example:

[101]
type=friend
username=101
secret=
mailbox=101
callerid=User One 101
host=dynamic
nat=yes
dtmfmode=rfc2833
canreinvite=no
reinvite=no
qualify=yes
setvar=EXTERNAL_CALLERID=User One 3012323434

And then in extensions.conf:

exten = _1NXXNXX,1,Set(CALLERID(all)=${EXTERNAL_CALLERID})
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)

Of course you could add some sanity checking there to make sure that
${EXTERNAL_CALLERID} contains a value and if not default to your
main DID.

-- 
Joshua Colp
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread William Stillwell


-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Joshua Colp
Sent: Sunday, December 19, 2010 2:40 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Specifying DID for outbound calls

- Original Message -
 The host I am working with has two accounts from the same DID
 provider. Incoming calls work correctly and dial the appropriate
 extensions. This also allows incoming calls to be billed appropriately
 to the
 individual DID accounts.
 
 Outgoing calls from either extension default to the first DID, i.e.
 calls from either extension have the same callerID. How can an
 extension specify separate outgoing contexts so the correct number is
 associated with it, also allowing the SIP provider to recognize the
 difference for billing purposes, or is there a better way?
 
 In short I'm looking to associate an outgoing call from an extension
 with a specific number.
 
 Here's the sip.conf for both accounts as they are using IP routing,
 I'm assuming I do not have to perform auth based to separate the two
 accounts for outgoing calls:

I'm surprised nobody has suggested using the setvar functionality. It's
extremely
useful for stuff like this and would allow you to keep all CallerID
information
with the actual configuration of the device.

Using a configuration entry for sip.conf in another response as an example:

[101]
type=friend
username=101
secret=
mailbox=101
callerid=User One 101
host=dynamic
nat=yes
dtmfmode=rfc2833
canreinvite=no
reinvite=no
qualify=yes
setvar=EXTERNAL_CALLERID=User One 3012323434

And then in extensions.conf:

exten = _1NXXNXX,1,Set(CALLERID(all)=${EXTERNAL_CALLERID})
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)

Of course you could add some sanity checking there to make sure that
${EXTERNAL_CALLERID} contains a value and if not default to your
main DID.


How would that work if a user has 3 different callerids, and the use of
realtime?

William Stillwell



--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Joshua Colp
- Original Message -
 -Original Message-
 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Joshua
 Colp
 Sent: Sunday, December 19, 2010 2:40 PM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] Specifying DID for outbound calls
 
 - Original Message -
  The host I am working with has two accounts from the same DID
  provider. Incoming calls work correctly and dial the appropriate
  extensions. This also allows incoming calls to be billed
  appropriately
  to the
  individual DID accounts.
 
  Outgoing calls from either extension default to the first DID, i.e.
  calls from either extension have the same callerID. How can an
  extension specify separate outgoing contexts so the correct number
  is
  associated with it, also allowing the SIP provider to recognize the
  difference for billing purposes, or is there a better way?
 
  In short I'm looking to associate an outgoing call from an extension
  with a specific number.
 
  Here's the sip.conf for both accounts as they are using IP routing,
  I'm assuming I do not have to perform auth based to separate the two
  accounts for outgoing calls:
 
 I'm surprised nobody has suggested using the setvar functionality.
 It's
 extremely
 useful for stuff like this and would allow you to keep all CallerID
 information
 with the actual configuration of the device.
 
 Using a configuration entry for sip.conf in another response as an
 example:
 
 [101]
 type=friend
 username=101
 secret=
 mailbox=101
 callerid=User One 101
 host=dynamic
 nat=yes
 dtmfmode=rfc2833
 canreinvite=no
 reinvite=no
 qualify=yes
 setvar=EXTERNAL_CALLERID=User One 3012323434
 
 And then in extensions.conf:
 
 exten = _1NXXNXX,1,Set(CALLERID(all)=${EXTERNAL_CALLERID})
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 
 Of course you could add some sanity checking there to make sure that
 ${EXTERNAL_CALLERID} contains a value and if not default to your
 main DID.
 
 
 How would that work if a user has 3 different callerids, and the use
 of
 realtime?

If there are 3 different CallerIDs then you would have three differently
named dialplan variables containing the appropriate CallerID information
for each. The logic would have to know which dialplan variable to use depending
on the situation, but it would already have to know that regardless.

The only difference is having the CallerID stored with the device configuration
versus in dialplan logic itself.

As for realtime I have not utilized setvar with it but it may be possible to
separate each variable and value using , just a theory though.

-- 
Joshua Colp
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Joshua Colp
- Original Message -
 On Sun, Dec 19, 2010 at 2:40 PM, Joshua Colp jc...@digium.com wrote:
  I'm surprised nobody has suggested using the setvar functionality.
  It's extremely
  useful for stuff like this and would allow you to keep all CallerID
  information
  with the actual configuration of the device.
 
  Using a configuration entry for sip.conf in another response as an
  example:
 
  [101]
  type=friend
  username=101
  secret=
  mailbox=101
  callerid=User One 101
  host=dynamic
  nat=yes
  dtmfmode=rfc2833
  canreinvite=no
  reinvite=no
  qualify=yes
  setvar=EXTERNAL_CALLERID=User One 3012323434
 
  And then in extensions.conf:
 
  exten = _1NXXNXX,1,Set(CALLERID(all)=${EXTERNAL_CALLERID})
  exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 
  Of course you could add some sanity checking there to make sure that
  ${EXTERNAL_CALLERID} contains a value and if not default to your
  main DID.
 
  --
  Joshua Colp
  Digium, Inc. | Software Developer
  445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
  Check us out at: www.digium.com  www.asterisk.org
 
 Joshua, that seems reasonable. I have two best practice questions
 before moving further if anyone would like to chime in.
 
 First, when using multiple accounts from the same DID provider, is it
 ideal to use IP based routing using one context as I currently am or
 have a separate contexts for each account in the sip.conf?

That's really the only way to do it presently.

 Secondly, it never crossed my mind that the caller-ID was being set in
 the sip.conf and extensions.conf. I guess the extension.conf takes
 precedence. At this point is was not my intention to use the sip.conf
 and I can easily remove it and set the variable in the extension.conf.
 I am just not familiar with what is ideal.

The callerid option configures the CallerID that is set on the channel when a 
call
comes in from the device. Since there is no logic at that time you can't specify
multiple CallerID values.

The CALLERID dialplan function allows you to change the CallerID on the channel 
through
logic you have constructed. It does not care about the previous CallerID, it 
simply changes
it.

The suggestion I previously mentioned is a sort of mix of both, it allows you 
to set
a separate CallerID when dialing externally by utilizing the setvar option to 
make it
available in the dialplan and then the CALLERID dialplan function to actually 
change it.

Since the above logic would, presumably, only be executed when dialing 
externally you still
need the callerid option set for non-external calls.

-- 
Joshua Colp
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Stephen Reese
 First, when using multiple accounts from the same DID provider, is it
 ideal to use IP based routing using one context as I currently am or
 have a separate contexts for each account in the sip.conf?

 That's really the only way to do it presently.

So I should have multiple incoming and outgoing contexts? Vitelity
will allow me to use IP routing or user/pass auth, the latter would
allow me to specify the outgoing context, this would also guarantee
the correct account is billed and not alone rely on caller-ID.

Thanks for being responsive, I do not work with Asterisk much,
actually I do not touch it unless I need to add more functionality
outside of regular patching so my fu is not strong in this area ;-)

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Joshua Colp
- Original Message -
  First, when using multiple accounts from the same DID provider, is
  it
  ideal to use IP based routing using one context as I currently am
  or
  have a separate contexts for each account in the sip.conf?
 
  That's really the only way to do it presently.
 
 So I should have multiple incoming and outgoing contexts? Vitelity
 will allow me to use IP routing or user/pass auth, the latter would
 allow me to specify the outgoing context, this would also guarantee
 the correct account is billed and not alone rely on caller-ID.

Let me clarify further. For calls FROM vitelity you are pretty much
limited to a single context in sip.conf doing IP based matching. Most
equipment will not authenticate to you, and chan_sip currently has no
additional method for separating the accounts into separate contexts.

For calls TO vitelity you should probably have separate contexts.
 
 Thanks for being responsive, I do not work with Asterisk much,
 actually I do not touch it unless I need to add more functionality
 outside of regular patching so my fu is not strong in this area ;-)


-- 
Joshua Colp
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Stephen Reese
 So I should have multiple incoming and outgoing contexts? Vitelity
 will allow me to use IP routing or user/pass auth, the latter would
 allow me to specify the outgoing context, this would also guarantee
 the correct account is billed and not alone rely on caller-ID.

 Let me clarify further. For calls FROM vitelity you are pretty much
 limited to a single context in sip.conf doing IP based matching. Most
 equipment will not authenticate to you, and chan_sip currently has no
 additional method for separating the accounts into separate contexts.

 For calls TO vitelity you should probably have separate contexts.

 Thanks for being responsive, I do not work with Asterisk much,
 actually I do not touch it unless I need to add more functionality
 outside of regular patching so my fu is not strong in this area ;-)


 --
 Joshua Colp
 Digium, Inc. | Software Developer
 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
 Check us out at:  www.digium.com   www.asterisk.org


Great, I'll get it changed and see if it helps, thanks.

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Stephen Reese
On Sun, Dec 19, 2010 at 4:36 AM, Jeroen Eeuwes jeroeneeu...@gmail.com wrote:
 Hi Stephen,

 Thanks for the heads up, I have been setting the caller-ID but the
 trouble I'm running into is specifying the which number to call out
 as. How can an extension specify a different number? See below for my
 current extension.conf, thanks.

 You can check the channel-name to see which extension is making the
 call and set the CallerID accordingly. The channel-name will be
 something like SIP/201-abc23ef34 or SIP/User1-def34abc51. The 201
 or User1 part depends on how you put the username in sip.conf  You can
 use the CUT function to get the calling extension and then jump to the
 correct CallerID. I've used something like this:

 [outgoing]
 exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
 exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
 exten = _1NXXNXX,n,GotoIf($[${Outgoing} = User2]?20:10)
 exten = _1NXXNXX,10,Set(CALLERID(num)=3012323434)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User1)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)
 exten = _1NXXNXX,20,Set(CALLERID(num)=3013232322)
 exten = _1NXXNXX,n,Set(CALLERID(name)=User2)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)

 But in my case I had two different domains. E.g.
 Dial(SIP/${ext...@provider-id1) and Dial(SIP/${ext...@provider-id2)
 instead of setting the CallerID.

 Not that the Cut doesn't work correctly if you use a minus-sign in the 
 username.

 Best regards,
 Jeroen Eeuwes

I believe I have made a little headway. I have two outgoing DID
contexts and have changed the GotoIf statement to the extension name.
User One acts as expected and User two now displays unknown when
calling so I believe it is trying to to goto 20 but it's not quite
making it. Any tips? Thanks

[outgoing]
exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
exten = _1NXXNXX,n,GotoIf($[${Outgoing} = 201]?20:10)
exten = _1NXXNXX,10,Set(CALLERID(all)=User One 3012323434)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
exten = _1NXXNXX,n,Goto(h,1)
exten = _1NXXNXX,20,Set(CALLERID(num)=User Two 3013232322)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound2)
exten = _1NXXNXX,n,Goto(h,1)

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Jonathan Thurman
On Sun, Dec 19, 2010 at 2:57 PM, Stephen Reese rsre...@gmail.com wrote:
 I believe I have made a little headway. I have two outgoing DID
 contexts and have changed the GotoIf statement to the extension name.
 User One acts as expected and User two now displays unknown when
 calling so I believe it is trying to to goto 20 but it's not quite
 making it. Any tips? Thanks

 [outgoing]
 exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
 exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
 exten = _1NXXNXX,n,GotoIf($[${Outgoing} = 201]?20:10)
 exten = _1NXXNXX,10,Set(CALLERID(all)=User One 3012323434)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)
 exten = _1NXXNXX,20,Set(CALLERID(num)=User Two 3013232322)

This should either be CALLERID(all) or just set the number on the line
above.  As a side note, I prefer to use labels an not line numbers.
Less to change later...

 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound2)
 exten = _1NXXNXX,n,Goto(h,1)

I'll also give a +1 to using setvar.  It allows you to abstract the
dial plan much more.  I use this feature a lot in both static and
Realtime configurations.  For example (not tested, but based on live
production code):

sip.conf:
[101]
...
setvar=EXTERNAL_CALLERID=User One 3012323434

[201]
...
setvar=EXTERNAL_CALLERID=User Two 3013232322



extensions.conf:
[outgoing]
exten = _1NXXNXX,1,Verbose(1, Someone is making a call out)
exten = 
_1NXXNXX,n,ExecIf($[${EXISTS(${EXTERNAL_CALLERID})}]?Set(CALLERID(all)=${EXTERNAL_CALLERID}))
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)


But then I am sure there are 100 other ways to do this same thing.

-Jonathan

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-19 Thread Stephen Reese
 I believe I have made a little headway. I have two outgoing DID
 contexts and have changed the GotoIf statement to the extension name.
 User One acts as expected and User two now displays unknown when
 calling so I believe it is trying to to goto 20 but it's not quite
 making it. Any tips? Thanks

 [outgoing]
 exten = _1NXXNXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
 exten = _1NXXNXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
 exten = _1NXXNXX,n,GotoIf($[${Outgoing} = 201]?20:10)
 exten = _1NXXNXX,10,Set(CALLERID(all)=User One 3012323434)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)
 exten = _1NXXNXX,n,Goto(h,1)
 exten = _1NXXNXX,20,Set(CALLERID(num)=User Two 3013232322)
 exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound2)
 exten = _1NXXNXX,n,Goto(h,1)


Disregard, I had num instead of all for the CALLERID statement.

Thanks for all of the help!

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Specifying DID for outbound calls

2010-12-18 Thread Stephen Reese
The host I am working with has two accounts from the same DID
provider. Incoming calls work correctly and dial the appropriate
extensions. This also allows incoming calls to be billed appropriately to the
individual DID accounts.

Outgoing calls from either extension default to the first DID, i.e.
calls from either extension have the same callerID. How can an
extension specify separate outgoing contexts so the correct number is
associated with it, also allowing the SIP provider to recognize the
difference for billing purposes, or is there a better way?

In short I'm looking to associate an outgoing call from an extension
with a specific number.

Here's the sip.conf for both accounts as they are using IP routing,
I'm assuming I do not have to perform auth based to separate the two
accounts for outgoing calls:

[vitel-inbound]
type=friend
dtmfmode=auto
host=inbound18.vitelity.net
context=inbound
allow=all
insecure=very

[vitel-outbound]
type=friend
dtmfmode=auto
host=outbound.vitelity.net
context=outbound
insecure=very
allow=all

Thanks

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Specifying DID for outbound calls

2010-12-18 Thread Jonathan Thurman
On Sat, Dec 18, 2010 at 4:03 PM, Stephen Reese rsre...@gmail.com wrote:

 The host I am working with has two accounts from the same DID
 provider. Incoming calls work correctly and dial the appropriate
 extensions. This also allows incoming calls to be billed appropriately to
 the
 individual DID accounts.

 Outgoing calls from either extension default to the first DID, i.e.
 calls from either extension have the same callerID. How can an
 extension specify separate outgoing contexts so the correct number is
 associated with it, also allowing the SIP provider to recognize the
 difference for billing purposes, or is there a better way?

The outgoing caller-id is probably just the extension number, so the
provider is setting it to a default (usually the main billing number).  You
can set what Asterisk sends as the outbound Caller-ID in the outbound
context before the Dial statement.  Make sure your provider will honor what
you set, as many filter what you can send to only the DIDs they provide for
you.

Take a look here for more information on setting the caller-id in the
dialplan:

http://www.voip-info.org/wiki/view/Asterisk+func+callerid

-Jonathan
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Specifying DID for outbound calls

2010-12-18 Thread Stephen Reese
 The outgoing caller-id is probably just the extension number, so the
 provider is setting it to a default (usually the main billing number).  You
 can set what Asterisk sends as the outbound Caller-ID in the outbound
 context before the Dial statement.  Make sure your provider will honor what
 you set, as many filter what you can send to only the DIDs they provide for
 you.

 Take a look here for more information on setting the caller-id in the
 dialplan:

 http://www.voip-info.org/wiki/view/Asterisk+func+callerid

 -Jonathan

Thanks for the heads up, I have been setting the caller-ID but the
trouble I'm running into is specifying the which number to call out
as. How can an extension specify a different number? See below for my
current extension.conf, thanks.

[default]
exten = 201,1,Dial(SIP/201@,30)
exten = 201,n,Voicemail(2...@default)
exten = 201,n,Hangup

exten = 202,1,Dial(SIP/202,30)
exten = 202,n,Voicemail(2...@default)
exten = 202,n,Hangup


include = inbound
include = outgoing

[inbound]
exten = 3012323434,1,Goto(default,201,1)
exten = 3013232322,1,Goto(default,202,1)

[outgoing]

exten = _1NXXNXX,1,Set(CALLERID(num)=3012323434)
exten = _1NXXNXX,n,Set(CALLERID(name)=User1)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)

[outgoing2]

exten = _1NXXNXX,1,Set(CALLERID(num)=3013232322)
exten = _1NXXNXX,n,Set(CALLERID(name)=User2)
exten = _1NXXNXX,n,Dial(SIP/${ext...@vitel-outbound)

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users