How to use common SIP/PSTN lines via dundi between 2 asterisks

Hello all,
I just hd success with announcing extensions between 2 asterisk servers via dundi…
On my primary asterisk server (lets call siteA) I created a sip trunk called poivy…
And also set outbound dialing prefix etc on it which has a dialing rule as NXXXXXX.
I wanted to do the same settings on dundi to announce a NXXXXXX extension to other asterisk, so if anybody wants to dial such number they should be forwarded to siteA.

Now i have a working dundi between both servers. And a fully working SIP trunk.
How should we configure it?
I tried a config as follows:

; If you are freely delivering calls to the PSTN, list them here
exten => _NXXXXXX, 1, Dial(SIP/poivy${EXTEN})
exten => _NXXXXXX, 2, congestion()
exten => _NXXXXXX, 102, busy()

It announces fine.And when i dial NXXXXXX from siteB it redirects it to siteA. But i think because of my “bad” config it does not forward it to my trunk…

And also i tried this "exten => _NXXXXXX,1,Dial(SIP/poivy/${EXTEN})"
config according to the example in extension example. ";exten => _XXXXXXXXXX,1,Dial(Zap/g0/${EXTEN})"
It didnt work too.

Hi again…
I changed my extension_custom.conf as

exten => _NXXXXXX,1,noop()
include => from-internal

and also added to siteB an outbound calling rule to dundi/priv
And yes… I got the phone ringing via SIP.
But… what is strange is, when the phone is ringing, i dont hear any ring tone on siteB client.
But when the phone pickedup voice traffic goes well.
But if i make the same call from siteA where the original SIP account registered, everything works as it should be.

Sorry about messing up with such questions…Just a newbie trying to figure out advanced asterisk configs :slight_smile:

Edit…And also noticed, on logfiles of SiteA i see the calling id as IAX2/priv-xxxxx not as the original calling number.
So it is making it difficult for us for the billing purposes.

First, delete everything you have setup so far with dundi. Then follow the instructions on this link.

You will then have a good setup to be able to share phone lines, extensions and other stuff.