you can do both ways.
1) From hangup_url
(within your welcome.php
). When a call is answered, Plivo sends a POST request with a set of parameters including the two. So you can parse the request from there. (Check out the "Request Parameters" section at http://plivo.com/docs/xml/request/)
2) From callbackUrl
(within your conf_handler.php'). Once you set up the
conf_handler.phpin the
callbackUrl`, Plivo will send a set of parameters as described at http://plivo.com/docs/xml/dial/#dialcallbackUrl
After that, you just need to parse the POST request and store as variables. (perhaps you could refer to http://www.tutorialspoint.com/php/php_get_post.htm)
Let me know if anything isn't clear. And I work at Plivo.